Coverage Report - net.admin4j.vo.BaseVO
 
Classes in this File Line Coverage Branch Coverage Complexity
BaseVO
50%
1/2
N/A
1.75
 
 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.vo;
 15  
 
 16  
 import java.io.Serializable;
 17  
 
 18  
 import net.admin4j.deps.commons.beanutils.BeanUtils;
 19  
 import net.admin4j.deps.commons.lang3.builder.EqualsBuilder;
 20  
 import net.admin4j.deps.commons.lang3.builder.HashCodeBuilder;
 21  
 import net.admin4j.deps.commons.lang3.builder.ReflectionToStringBuilder;
 22  
 import net.admin4j.deps.commons.lang3.exception.ContextedRuntimeException;
 23  
 
 24  
 /**
 25  
  * Base Value Object implementing equals(), hashCode(), toString() and clone() 
 26  
  * @author D. Ashmore
 27  
  *
 28  
  */
 29  565
 public abstract class BaseVO implements Serializable, Cloneable {
 30  
 
 31  
     private static final long serialVersionUID = 2618192279106780874L;
 32  
 
 33  
     /* (non-Javadoc)
 34  
      * @see java.lang.Object#hashCode()
 35  
      */
 36  
     @Override
 37  
     public int hashCode() {
 38  
         return HashCodeBuilder.reflectionHashCode(17, 37, this);
 39  
     }
 40  
 
 41  
     /* (non-Javadoc)
 42  
      * @see java.lang.Object#equals(java.lang.Object)
 43  
      */
 44  
     @Override
 45  
     public boolean equals(Object obj) {
 46  
         return EqualsBuilder.reflectionEquals(this, obj);
 47  
     }
 48  
 
 49  
     /* (non-Javadoc)
 50  
      * @see java.lang.Object#clone()
 51  
      */
 52  
     @Override
 53  
     public Object clone() throws CloneNotSupportedException {
 54  
         try {
 55  
             return BeanUtils.cloneBean(this);
 56  0
         } catch (Exception e) {
 57  
             throw new ContextedRuntimeException("Error cloning value object", e)
 58  
                 .addContextValue("class", this.getClass().getName());
 59  
         }
 60  
     }
 61  
 
 62  
     /* (non-Javadoc)
 63  
      * @see java.lang.Object#toString()
 64  
      */
 65  
     @Override
 66  
     public String toString() {
 67  
         return new ReflectionToStringBuilder(this).toString();
 68  
     }
 69  
 
 70  
 }