Coverage Report - org.simpleframework.xml.core.ClassType
 
Classes in this File Line Coverage Branch Coverage Complexity
ClassType
100%
6/6
N/A
1
 
 1  
 /*
 2  
  * ClassType.java January 2010
 3  
  *
 4  
  * Copyright (C) 2010, Niall Gallagher <niallg@users.sf.net>
 5  
  *
 6  
  * Licensed under the Apache License, Version 2.0 (the "License");
 7  
  * you may not use this file except in compliance with the License.
 8  
  * You may obtain a copy of the License at
 9  
  *
 10  
  *     http://www.apache.org/licenses/LICENSE-2.0
 11  
  *
 12  
  * Unless required by applicable law or agreed to in writing, software
 13  
  * distributed under the License is distributed on an "AS IS" BASIS,
 14  
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 
 15  
  * implied. See the License for the specific language governing 
 16  
  * permissions and limitations under the License.
 17  
  */
 18  
 
 19  
 package org.simpleframework.xml.core;
 20  
 
 21  
 import java.lang.annotation.Annotation;
 22  
 
 23  
 import org.simpleframework.xml.strategy.Type;
 24  
 
 25  
 /**
 26  
  * The <code>ClassType</code> object is used to represent a type that
 27  
  * is neither a field or method. Such a type is used when an object
 28  
  * is to be used to populate a collection. In such a scenario there
 29  
  * is no method or field annotations associated with the object.
 30  
  * 
 31  
  * @author Niall Gallagher
 32  
  */
 33  
 class ClassType implements Type {
 34  
    
 35  
    /**
 36  
     * This is the type that is represented by this instance.
 37  
     */
 38  
    private final Class type;
 39  
    
 40  
    /**
 41  
     * Constructor for the <code>ClassType</code> object. This will
 42  
     * create a type used to represent a stand alone object, such
 43  
     * as an object being inserted in to a Java collection.
 44  
     * 
 45  
     * @param type this is the class that this type represents
 46  
     */
 47  885114
    public ClassType(Class type) {
 48  885114
       this.type = type;
 49  885114
    }
 50  
 
 51  
    /**
 52  
     * This is the class associated with this type. This is used by
 53  
     * the serialization framework to determine how the XML is to
 54  
     * be converted in to an object and vice versa.
 55  
     * 
 56  
     * @return this returns the class associated with this type
 57  
     */
 58  
    public Class getType() {
 59  3569233
       return type;
 60  
    }
 61  
    
 62  
    /**
 63  
     * This is used to acquire an annotation of the specified type.
 64  
     * If no such annotation exists for the type then this will
 65  
     * return null. Currently for classes this will always be null.
 66  
     * 
 67  
     * @param type this is the annotation type be be acquired
 68  
     * 
 69  
     * @return currently this method will always return null
 70  
     */
 71  
    public <T extends Annotation> T getAnnotation(Class<T> type) {
 72  65
       return null;
 73  
    }
 74  
    
 75  
    /**
 76  
     * This is used to describe the type as it exists within the
 77  
     * owning class. This is used to provide error messages that can
 78  
     * be used to debug issues that occur when processing.  
 79  
     * 
 80  
     * @return this returns a string representation of the type
 81  
     */
 82  
    public String toString() {
 83  15
       return type.toString();
 84  
    }
 85  
 }