Package org.apache.tapestry5.plastic
Class MethodDescription
java.lang.Object
org.apache.tapestry5.plastic.MethodDescription
- All Implemented Interfaces:
Comparable<MethodDescription>
Describes a
PlasticMethod
in terms of a method name, a set of modifiers
(public, private, static, final, etc.), a return type, types of method arguments,
and types of checked exceptions. Types are represented as Java source names:
either names of primitives ("void", "byte", "long") or fully qualified class names ("java.lang.Object",
"java.lang.Runnable"). ASM refers to this as "class name".
MethodDescriptions are immutable, and properly implement equals() and hashCode(); they are often used as keys in
Maps.
The natural sort order for a MethodDescription is ascending order by method name, then descending order by number of
parameters (for the same name). Sort order is not currently specified for overrides of the same method with the same
number of parameters.
TODO: Handling generic types.-
Field Summary
FieldsModifier and TypeFieldDescriptionfinal String[]
A non-null array of Java source names for arguments.final String[]
A non-null array of Java source names for checked exceptions.final String
final String
The name of the method.final int
The full set of modifier flags for the method.final String
The Java source name for the return type, e.g., "void", "short", "java.util.Map", "java.lang.String[]". -
Constructor Summary
ConstructorsConstructorDescriptionMethodDescription
(int modifiers, String returnType, String methodName, String[] argumentTypes, String genericSignature, String[] checkedExceptionTypes) MethodDescription
(Method method) Creates a MethodDescription from a Java Method.MethodDescription
(String returnType, String methodName, String... argumentTypes) Convenience constructor for public methods that have no checked exceptions.MethodDescription
(MethodDescription description, String[] checkedExceptionTypes) Convenience constructor for copying a MethodDescription with different exception types. -
Method Summary
Modifier and TypeMethodDescriptionint
boolean
int
hashCode()
A string used to identify the method, containing just the method name and argument types (but ignoring visibility, return type and thrown exceptions).toString()
withModifiers
(int newModifiers)
-
Field Details
-
modifiers
The full set of modifier flags for the method. -
returnType
The Java source name for the return type, e.g., "void", "short", "java.util.Map", "java.lang.String[]". -
methodName
The name of the method. -
genericSignature
-
argumentTypes
A non-null array of Java source names for arguments. Do not modify the contents of this array. -
checkedExceptionTypes
A non-null array of Java source names for checked exceptions. Do not modify the contents of this array.
-
-
Constructor Details
-
MethodDescription
Convenience constructor for public methods that have no checked exceptions.- Parameters:
returnType
- return type as type namemethodName
- name of methodargumentTypes
- type names for arguments
-
MethodDescription
Convenience constructor for copying a MethodDescription with different exception types.- Since:
- 5.4.4
-
MethodDescription
public MethodDescription(int modifiers, String returnType, String methodName, String[] argumentTypes, String genericSignature, String[] checkedExceptionTypes) - Parameters:
modifiers
-returnType
- Java source name for the return typemethodName
-argumentTypes
- may be nullgenericSignature
- TODOcheckedExceptionTypes
- may be null
-
MethodDescription
Creates a MethodDescription from a Java Method. The generic signature will be null.
-
-
Method Details
-
withModifiers
-
compareTo
- Specified by:
compareTo
in interfaceComparable<MethodDescription>
-
hashCode
-
equals
-
toString
-
toShortString
A string used to identify the method, containing just the method name and argument types (but ignoring visibility, return type and thrown exceptions).- Returns:
- method identifier
-