public class Method extends Object
Constructor and Description |
---|
Method(String name,
String desc)
Creates a new
Method . |
Method(String name,
Type returnType,
Type[] argumentTypes)
Creates a new
Method . |
Modifier and Type | Method and Description |
---|---|
boolean |
equals(Object o) |
Type[] |
getArgumentTypes()
Returns the argument types of the method described by this object.
|
String |
getDescriptor()
Returns the descriptor of the method described by this object.
|
static Method |
getMethod(Constructor<?> c)
Creates a new
Method . |
static Method |
getMethod(Method m)
Creates a new
Method . |
static Method |
getMethod(String method)
Returns a
Method corresponding to the given Java method
declaration. |
static Method |
getMethod(String method,
boolean defaultPackage)
Returns a
Method corresponding to the given Java method
declaration. |
String |
getName()
Returns the name of the method described by this object.
|
Type |
getReturnType()
Returns the return type of the method described by this object.
|
int |
hashCode() |
String |
toString() |
public Method(String name, String desc)
Method
.name
- the method's name.desc
- the method's descriptor.public static Method getMethod(Method m)
Method
.m
- a java.lang.reflect method descriptorMethod
corresponding to the given Java method
declaration.public static Method getMethod(Constructor<?> c)
Method
.c
- a java.lang.reflect constructor descriptorMethod
corresponding to the given Java constructor
declaration.public static Method getMethod(String method) throws IllegalArgumentException
Method
corresponding to the given Java method
declaration.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.Method
corresponding to the given Java method
declaration.IllegalArgumentException
- if method
could not get parsed.public static Method getMethod(String method, boolean defaultPackage) throws IllegalArgumentException
Method
corresponding to the given Java method
declaration.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.Method
corresponding to the given Java method
declaration.IllegalArgumentException
- if method
could not get parsed.public String getName()
public String getDescriptor()
public Type getReturnType()
public Type[] getArgumentTypes()
Copyright © 2018. All rights reserved.