Coverage Report - org.simpleframework.xml.strategy.Type
 
Classes in this File Line Coverage Branch Coverage Complexity
Type
N/A
N/A
1
 
 1  
 /*
 2  
  * Type.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.strategy;
 20  
 
 21  
 import java.lang.annotation.Annotation;
 22  
 
 23  
 /**
 24  
  * The <code>Type</code> interface is used to represent a method or
 25  
  * field that has been annotated for serialization. Representing 
 26  
  * methods and fields as a generic type object allows various
 27  
  * common details to be extracted in a uniform way. It allows all
 28  
  * annotations on the method or field to be exposed. This can 
 29  
  * also wrap classes that represent entries to a list or map.
 30  
  * 
 31  
  * @author Niall Gallagher
 32  
  */
 33  
 public interface Type {
 34  
    
 35  
    /**
 36  
     * This will provide the method or field type. The type is the
 37  
     * class that is to be read and written on the object. Typically 
 38  
     * the type will be a serializable object or a primitive type.
 39  
     *
 40  
     * @return this returns the type for this method o field
 41  
     */ 
 42  
    Class getType();
 43  
    
 44  
    /**
 45  
     * This is the annotation associated with the method or field
 46  
     * that has been annotated. If this represents an entry to a 
 47  
     * Java collection such as a <code>java.util.List</code> then
 48  
     * this will return null for any annotation requested.
 49  
     * 
 50  
     * @param type this is the type of the annotation to acquire
 51  
     *
 52  
     * @return this provides the annotation associated with this
 53  
     */
 54  
    <T extends Annotation> T getAnnotation(Class<T> type);
 55  
    
 56  
    /**
 57  
     * This is used to describe the type as it exists within the
 58  
     * owning class. This is used to provide error messages that can
 59  
     * be used to debug issues that occur when processing.  
 60  
     * 
 61  
     * @return this returns a string representation of the type
 62  
     */
 63  
    String toString();
 64  
 }