| Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
| MethodName |
|
| 1.0;1 |
| 1 | /* | |
| 2 | * MethodName.java April 2007 | |
| 3 | * | |
| 4 | * Copyright (C) 2007, Niall Gallagher <niallg@users.sf.net> | |
| 5 | * | |
| 6 | * This library is free software; you can redistribute it and/or | |
| 7 | * modify it under the terms of the GNU Lesser General Public | |
| 8 | * License as published by the Free Software Foundation. | |
| 9 | * | |
| 10 | * This library is distributed in the hope that it will be useful, | |
| 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| 13 | * GNU Lesser General Public License for more details. | |
| 14 | * | |
| 15 | * You should have received a copy of the GNU Lesser General | |
| 16 | * Public License along with this library; if not, write to the | |
| 17 | * Free Software Foundation, Inc., 59 Temple Place, Suite 330, | |
| 18 | * Boston, MA 02111-1307 USA | |
| 19 | */ | |
| 20 | ||
| 21 | package org.simpleframework.xml.load; | |
| 22 | ||
| 23 | import java.lang.reflect.Method; | |
| 24 | ||
| 25 | /** | |
| 26 | * The <code>MethodName</code> object is used to represent the name | |
| 27 | * of a Java Bean method. This contains the Java Bean name the type | |
| 28 | * and the actual method it represents. This allows the scanner to | |
| 29 | * create <code>MethodPart</code> objects based on the method type. | |
| 30 | * | |
| 31 | * @author Niall Gallagher | |
| 32 | */ | |
| 33 | class MethodName { | |
| 34 | ||
| 35 | /** | |
| 36 | * This is the type of method this method name represents. | |
| 37 | */ | |
| 38 | private MethodType type; | |
| 39 | ||
| 40 | /** | |
| 41 | * This is the actual method that this method name represents. | |
| 42 | */ | |
| 43 | private Method method; | |
| 44 | ||
| 45 | /** | |
| 46 | * This is the Java Bean method name that is represented. | |
| 47 | */ | |
| 48 | private String name; | |
| 49 | ||
| 50 | /** | |
| 51 | * Constructor for the <code>MethodName</code> objects. This is | |
| 52 | * used to create a method name representation of a method based | |
| 53 | * on the method type and the Java Bean name of that method. | |
| 54 | * | |
| 55 | * @param method this is the actual method this is representing | |
| 56 | * @param type type used to determine if it is a set or get | |
| 57 | * @param name this is the Java Bean property name of the method | |
| 58 | */ | |
| 59 | 119 | public MethodName(Method method, MethodType type, String name) { |
| 60 | 119 | this.name = name.intern(); |
| 61 | 119 | this.method = method; |
| 62 | 119 | this.type = type; |
| 63 | 119 | } |
| 64 | ||
| 65 | /** | |
| 66 | * This provdes the name of the method part as acquired from the | |
| 67 | * method name. The name represents the Java Bean property name | |
| 68 | * of the method and is used to pair getter and setter methods. | |
| 69 | * | |
| 70 | * @return this returns the Java Bean name of the method part | |
| 71 | */ | |
| 72 | public String getName() { | |
| 73 | 119 | return name; |
| 74 | } | |
| 75 | ||
| 76 | /** | |
| 77 | * This is the method type for the method part. This is used in | |
| 78 | * the scanning process to determine which type of method a | |
| 79 | * instance represents, this allows set and get methods to be | |
| 80 | * paired. | |
| 81 | * | |
| 82 | * @return the method type that this part represents | |
| 83 | */ | |
| 84 | public MethodType getType() { | |
| 85 | 238 | return type; |
| 86 | } | |
| 87 | ||
| 88 | /** | |
| 89 | * This is the method for this point of contact. This is what | |
| 90 | * will be invoked by the serialization or deserialization | |
| 91 | * process when an XML element or attribute is to be used. | |
| 92 | * | |
| 93 | * @return this returns the method associated with this | |
| 94 | */ | |
| 95 | public Method getMethod() { | |
| 96 | 119 | return method; |
| 97 | } | |
| 98 | } |