Class Method
- java.lang.Object
-
- com.googlecode.aviator.asm.commons.Method
-
public class Method extends java.lang.ObjectA named method descriptor.
-
-
Field Summary
Fields Modifier and Type Field Description private java.lang.StringdescThe method descriptor.private static java.util.Map<java.lang.String,java.lang.String>DESCRIPTORSMaps primitive Java type names to their descriptors.private java.lang.StringnameThe method name.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanequals(java.lang.Object o)Type[]getArgumentTypes()Returns the argument types of the method described by this object.java.lang.StringgetDescriptor()Returns the descriptor of the method described by this object.static MethodgetMethod(java.lang.reflect.Constructor<?> c)Creates a newMethod.static MethodgetMethod(java.lang.reflect.Method m)Creates a newMethod.static MethodgetMethod(java.lang.String method)Returns aMethodcorresponding to the given Java method declaration.static MethodgetMethod(java.lang.String method, boolean defaultPackage)Returns aMethodcorresponding to the given Java method declaration.java.lang.StringgetName()Returns the name of the method described by this object.TypegetReturnType()Returns the return type of the method described by this object.inthashCode()private static java.lang.Stringmap(java.lang.String type, boolean defaultPackage)java.lang.StringtoString()
-
-
-
Constructor Detail
-
Method
public Method(java.lang.String name, java.lang.String desc)Creates a newMethod.- Parameters:
name- the method's name.desc- the method's descriptor.
-
-
Method Detail
-
getMethod
public static Method getMethod(java.lang.reflect.Method m)
Creates a newMethod.- Parameters:
m- a java.lang.reflect method descriptor- Returns:
- a
Methodcorresponding to the given Java method declaration.
-
getMethod
public static Method getMethod(java.lang.reflect.Constructor<?> c)
Creates a newMethod.- Parameters:
c- a java.lang.reflect constructor descriptor- Returns:
- a
Methodcorresponding to the given Java constructor declaration.
-
getMethod
public static Method getMethod(java.lang.String method) throws java.lang.IllegalArgumentException
Returns aMethodcorresponding to the given Java method declaration.- Parameters:
method- a Java method declaration, without argument names, of the form "returnType name (argumentType1, ... argumentTypeN)", where the types are in plain Java (e.g. "int", "float", "java.util.List", ...). Classes of the java.lang package can be specified by their unqualified name; all other classes names must be fully qualified.- Returns:
- a
Methodcorresponding to the given Java method declaration. - Throws:
java.lang.IllegalArgumentException- ifmethodcould not get parsed.
-
getMethod
public static Method getMethod(java.lang.String method, boolean defaultPackage) throws java.lang.IllegalArgumentException
Returns aMethodcorresponding to the given Java method declaration.- Parameters:
method- a Java method declaration, without argument names, of the form "returnType name (argumentType1, ... argumentTypeN)", where the types are in plain Java (e.g. "int", "float", "java.util.List", ...). Classes of the java.lang package may be specified by their unqualified name, depending on the defaultPackage argument; all other classes names must be fully qualified.defaultPackage- true if unqualified class names belong to the default package, or false if they correspond to java.lang classes. For instance "Object" means "Object" if this option is true, or "java.lang.Object" otherwise.- Returns:
- a
Methodcorresponding to the given Java method declaration. - Throws:
java.lang.IllegalArgumentException- ifmethodcould not get parsed.
-
map
private static java.lang.String map(java.lang.String type, boolean defaultPackage)
-
getName
public java.lang.String getName()
Returns the name of the method described by this object.- Returns:
- the name of the method described by this object.
-
getDescriptor
public java.lang.String getDescriptor()
Returns the descriptor of the method described by this object.- Returns:
- the descriptor of the method described by this object.
-
getReturnType
public Type getReturnType()
Returns the return type of the method described by this object.- Returns:
- the return type of the method described by this object.
-
getArgumentTypes
public Type[] getArgumentTypes()
Returns the argument types of the method described by this object.- Returns:
- the argument types of the method described by this object.
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
equals
public boolean equals(java.lang.Object o)
- Overrides:
equalsin classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
-