Coverage Report - net.sf.ezmorph.object.IdentityObjectMorpher
 
Classes in this File Line Coverage Branch Coverage Complexity
IdentityObjectMorpher
91%
10/11
75%
3/4
1
 
 1  
 /*
 2  
  * Copyright 2006-2007 the original author or authors.
 3  
  *
 4  
  * Licensed under the Apache License, Version 2.0 (the "License");
 5  
  * you may not use this file except in compliance with the License.
 6  
  * You may obtain a copy of the License at
 7  
  *
 8  
  *      http://www.apache.org/licenses/LICENSE-2.0
 9  
  *
 10  
  * Unless required by applicable law or agreed to in writing, software
 11  
  * distributed under the License is distributed on an "AS IS" BASIS,
 12  
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 13  
  * See the License for the specific language governing permissions and
 14  
  * limitations under the License.
 15  
  */
 16  
 
 17  
 package net.sf.ezmorph.object;
 18  
 
 19  
 import net.sf.ezmorph.ObjectMorpher;
 20  
 
 21  
 /**
 22  
  * Morpher that performs no conversion.<br>
 23  
  * This morpher is a singleton.
 24  
  * 
 25  
  * @author Andres Almiray <aalmiray@users.sourceforge.net>
 26  
  */
 27  3
 public final class IdentityObjectMorpher implements ObjectMorpher
 28  
 {
 29  4
    private static final IdentityObjectMorpher INSTANCE = new IdentityObjectMorpher();
 30  
 
 31  
    /**
 32  
     * Returns the singleton instance
 33  
     */
 34  
    public static IdentityObjectMorpher getInstance()
 35  
    {
 36  386
       return INSTANCE;
 37  
    }
 38  
 
 39  3
    private IdentityObjectMorpher()
 40  1
    {
 41  4
    }
 42  
 
 43  
    public boolean equals( Object obj )
 44  
    {
 45  4
       return INSTANCE == obj;
 46  
    }
 47  
 
 48  
    public int hashCode()
 49  
    {
 50  8
       return 42 + getClass().hashCode();
 51  
    }
 52  
 
 53  
    public Object morph( Object value )
 54  
    {
 55  188
       return value;
 56  
    }
 57  
 
 58  
    public Class morphsTo()
 59  
    {
 60  181
       return Object.class;
 61  
    }
 62  
 
 63  
    public boolean supports( Class clazz )
 64  
    {
 65  0
       return true;
 66  
    }
 67  
 }