Coverage Report - net.admin4j.entity.ExecutionStack
 
Classes in this File Line Coverage Branch Coverage Complexity
ExecutionStack
69%
9/13
50%
4/8
2.6
 
 1  
 /*
 2  
  * This software is licensed under the Apache License, Version 2.0
 3  
  * (the "License") agreement; you may not use this file except in compliance with
 4  
  * the License.  You may obtain a copy of the License at
 5  
  * 
 6  
  *      http://www.apache.org/licenses/LICENSE-2.0
 7  
  * 
 8  
  * Unless required by applicable law or agreed to in writing, software
 9  
  * distributed under the License is distributed on an "AS IS" BASIS,
 10  
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 11  
  * See the License for the specific language governing permissions and
 12  
  * limitations under the License.
 13  
  */
 14  
 package net.admin4j.entity;
 15  
 
 16  
 import net.admin4j.deps.commons.lang3.Validate;
 17  
 import net.admin4j.deps.commons.lang3.builder.EqualsBuilder;
 18  
 import net.admin4j.deps.commons.lang3.builder.HashCodeBuilder;
 19  
 import net.admin4j.deps.commons.lang3.builder.ToStringBuilder;
 20  
 
 21  
 /**
 22  
  * Geenric execution stack trace 
 23  
  * @author D. Ashmore
 24  
  *
 25  
  */
 26  
 public class ExecutionStack {
 27  
     
 28  
     private StackTraceElement[] stackTraceElementArray;
 29  
     
 30  180138
     public ExecutionStack(StackTraceElement[] stackArray) {
 31  
         Validate.notNull(stackArray, "Null stackArray not allowed.");
 32  180138
         stackTraceElementArray = stackArray;
 33  180138
     }
 34  
 
 35  180138
     Integer hashCode = null;
 36  
     /* (non-Javadoc)
 37  
      * @see java.lang.Object#hashCode()
 38  
      */
 39  
     @Override
 40  
     public int hashCode() {
 41  180174
         if (hashCode != null) {
 42  180138
             return hashCode;
 43  
         }
 44  
         hashCode = new HashCodeBuilder()
 45  
              .append(stackTraceElementArray)
 46  
              .toHashCode();
 47  36
         return hashCode;
 48  
     }
 49  
 
 50  
     /* (non-Javadoc)
 51  
      * @see java.lang.Object#equals(java.lang.Object)
 52  
      */
 53  
     @Override
 54  
     public boolean equals(Object obj) {
 55  60042
         if (obj == null) { return false; }
 56  60042
         if (obj == this) { return true; }
 57  0
         if (obj.getClass() != getClass()) {
 58  0
             return false;
 59  
         }
 60  0
         ExecutionStack rhs = (ExecutionStack) obj;
 61  
         return new EqualsBuilder()
 62  
             .append(this.stackTraceElementArray, rhs.stackTraceElementArray)
 63  
             .isEquals();
 64  
     }
 65  
 
 66  
     /* (non-Javadoc)
 67  
      * @see java.lang.Object#toString()
 68  
      */
 69  
     @Override
 70  
     public String toString() {
 71  
         return new ToStringBuilder(this)
 72  
             .append(this.stackTraceElementArray)
 73  
             .toString();
 74  
     }
 75  
 
 76  
     public StackTraceElement[] getStackTraceElementArray() {
 77  0
         return stackTraceElementArray;
 78  
     }
 79  
 
 80  
 }