Package org.teavm.model
Class MethodReference
java.lang.Object
org.teavm.model.MethodReference
- All Implemented Interfaces:
Serializable
Specifies a fully qualified name of a method, including its name, class name, parameter types
and return value type. This class overloads equals
and hashCode
so that any two references to one method are considered equal.
Though in Java language it is enough to have only parameter types to uniquely identify a method, JVM uses return value as well. Java generates bridge methods to make adjust the JVM's behavior.
- See Also:
-
Constructor Summary
ConstructorDescriptionMethodReference
(Class<?> cls, String name, Class<?>... signature) MethodReference
(String className, String name, ValueType... signature) Creates a new reference to a method.MethodReference
(String className, MethodDescriptor descriptor) -
Method Summary
Modifier and TypeMethodDescriptionboolean
getName()
int
hashCode()
int
parameterType
(int index) static MethodReference
static MethodReference
static MethodReference
parseIfPossible
(String string) toString()
-
Constructor Details
-
MethodReference
-
MethodReference
Creates a new reference to a method.
For example, here is how you should call this constructor to create a reference to the
Integer.valueOf(int)
method:new MethodReference("java.lang.Integer", "valueOf", ValueType.INT, ValueType.object("java.lang.Integer"))
- Parameters:
className
- the name of the class that owns the method.name
- the name of the method.signature
- descriptor of a method, as described in VM spec. The last element is a type of a returning value, and all the remaining elements are types of arguments.
-
MethodReference
-
-
Method Details
-
getClassName
-
getDescriptor
-
parameterCount
public int parameterCount() -
parameterType
-
getParameterTypes
-
getSignature
-
getReturnType
-
getName
-
hashCode
public int hashCode() -
equals
-
toString
-
parse
-
parseIfPossible
-
parse
-
signatureToString
-