Coverage Report - org.simpleframework.xml.core.MethodPart
 
Classes in this File Line Coverage Branch Coverage Complexity
MethodPart
N/A
N/A
1
 
 1  
 /*
 2  
  * MethodPart.java April 2007
 3  
  *
 4  
  * Copyright (C) 2007, 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  
 import java.lang.reflect.Method;
 23  
 
 24  
 /**
 25  
  * The <code>MethodPart</code> interface is used to provide a point 
 26  
  * of contact with an object. Typically this will be used to get a
 27  
  * method from an object which is contains an XML annotation. This
 28  
  * provides the type the method is associated with, this type is
 29  
  * either the method return type or the single value parameter.
 30  
  * 
 31  
  * @author Niall Gallagher
 32  
  */ 
 33  
 interface MethodPart {
 34  
 
 35  
    /**
 36  
     * This provides the name of the method part as acquired from the
 37  
     * method name. The name represents the Java Bean property name
 38  
     * of the method and is used to pair getter and setter methods.
 39  
     * 
 40  
     * @return this returns the Java Bean name of the method part
 41  
     */
 42  
    String getName(); 
 43  
    
 44  
    /**
 45  
     * This is the annotation associated with the point of contact.
 46  
     * This will be an XML annotation that describes how the contact
 47  
     * should be serializaed and deserialized from the object.
 48  
     *
 49  
     * @return this provides the annotation associated with this
 50  
     */
 51  
    Annotation getAnnotation();
 52  
    
 53  
    /**
 54  
     * This is the annotation associated with the point of contact.
 55  
     * This will be an XML annotation that describes how the contact
 56  
     * should be serialized and deserialized from the object.
 57  
     * 
 58  
     * @param type this is the type of the annotation to acquire
 59  
     *
 60  
     * @return this provides the annotation associated with this
 61  
     */
 62  
    <T extends Annotation> T getAnnotation(Class<T> type);
 63  
    
 64  
    /**
 65  
     * This will provide the contact type. The contact type is the
 66  
     * class that is either the method return type or the single
 67  
     * value parameter type associated with the method.
 68  
     *
 69  
     * @return this returns the type that this contact represents
 70  
     */ 
 71  
    Class getType();
 72  
    
 73  
    /**
 74  
     * This is used to acquire the dependent class for the method 
 75  
     * part. The dependent type is the type that represents the 
 76  
     * generic type of the type. This is used when collections are
 77  
     * annotated as it allows a default entry class to be taken
 78  
     * from the generic information provided.
 79  
     * 
 80  
     * @return this returns the generic dependent for the type
 81  
     */
 82  
    Class getDependent();
 83  
    
 84  
    /**
 85  
     * This is used to acquire the dependent classes for the method 
 86  
     * part. The dependent types are the types that represent the 
 87  
     * generic types of the type. This is used when collections are 
 88  
     * annotated as it allows a default entry class to be taken
 89  
     * from the generic information provided.
 90  
     * 
 91  
     * @return this returns the generic dependent for the type
 92  
     */
 93  
    Class[] getDependents();
 94  
    
 95  
    /**
 96  
     * This is the class that declares the contact. The declaring
 97  
     * class is where the method represented has been defined. This
 98  
     * will typically be a class rather than an interface.
 99  
     * 
 100  
     * @return this returns the class the part is declared within
 101  
     */
 102  
    Class getDeclaringClass();
 103  
    
 104  
    /**
 105  
     * This is the method for this point of contact. This is what
 106  
     * will be invoked by the serialization or deserialization 
 107  
     * process when an XML element or attribute is to be used.
 108  
     * 
 109  
     * @return this returns the method associated with this
 110  
     */
 111  
    Method getMethod();
 112  
    
 113  
    /**
 114  
     * This is the method type for the method part. This is used in
 115  
     * the scanning process to determine which type of method a
 116  
     * instance represents, this allows set and get methods to be
 117  
     * paired.
 118  
     * 
 119  
     * @return the method type that this part represents
 120  
     */
 121  
    MethodType getMethodType();
 122  
    
 123  
    /**
 124  
     * This is used to describe the method as it exists within the
 125  
     * owning class. This is used to provide error messages that can
 126  
     * be used to debug issues that occur when processing a method.
 127  
     * This should return the method as a generic representation.  
 128  
     * 
 129  
     * @return this returns a string representation of the method
 130  
     */
 131  
    String toString();
 132  
 }