Coverage Report - org.simpleframework.xml.core.MethodName
 
Classes in this File Line Coverage Branch Coverage Complexity
MethodName
100%
8/8
N/A
1
 
 1  
 /*
 2  
  * MethodName.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.reflect.Method;
 22  
 
 23  
 /**
 24  
  * The <code>MethodName</code> object is used to represent the name
 25  
  * of a Java Bean method. This contains the Java Bean name the type
 26  
  * and the actual method it represents. This allows the scanner to
 27  
  * create <code>MethodPart</code> objects based on the method type.
 28  
  * 
 29  
  * @author Niall Gallagher
 30  
  */
 31  
 class MethodName {
 32  
    
 33  
    /**
 34  
     * This is the type of method this method name represents.
 35  
     */
 36  
    private MethodType type;
 37  
    
 38  
    /**
 39  
     * This is the actual method that this method name represents.
 40  
     */
 41  
    private Method method;
 42  
    
 43  
    /**
 44  
     * This is the Java Bean method name that is represented.
 45  
     */
 46  
    private String name;
 47  
    
 48  
    /**
 49  
     * Constructor for the <code>MethodName</code> objects. This is
 50  
     * used to create a method name representation of a method based
 51  
     * on the method type and the Java Bean name of that method.
 52  
     * 
 53  
     * @param method this is the actual method this is representing
 54  
     * @param type type used to determine if it is a set or get
 55  
     * @param name this is the Java Bean property name of the method
 56  
     */
 57  534
    public MethodName(Method method, MethodType type, String name) {
 58  534
       this.method = method;
 59  534
       this.type = type;      
 60  534
       this.name = name;
 61  534
    }
 62  
    
 63  
    /**
 64  
     * This provides the name of the method part as acquired from the
 65  
     * method name. The name represents the Java Bean property name
 66  
     * of the method and is used to pair getter and setter methods.
 67  
     * 
 68  
     * @return this returns the Java Bean name of the method part
 69  
     */
 70  
    public String getName() {    
 71  534
       return name;
 72  
    }
 73  
    
 74  
    /**
 75  
     * This is the method type for the method part. This is used in
 76  
     * the scanning process to determine which type of method a
 77  
     * instance represents, this allows set and get methods to be
 78  
     * paired.
 79  
     * 
 80  
     * @return the method type that this part represents
 81  
     */ 
 82  
    public MethodType getType() {
 83  1068
       return type;
 84  
    }
 85  
    
 86  
    /**
 87  
     * This is the method for this point of contact. This is what
 88  
     * will be invoked by the serialization or deserialization 
 89  
     * process when an XML element or attribute is to be used.
 90  
     * 
 91  
     * @return this returns the method associated with this
 92  
     */
 93  
    public Method getMethod() {
 94  534
       return method;      
 95  
    }  
 96  
 }