Top Description Fields Constructors Methods
org.eclipse.persistence.internal.libraries.asm.commons

public Class Method

extends Object
Class Inheritance
Imports
java.util.HashMap, .Map, org.eclipse.persistence.internal.libraries.asm.Type

A named method descriptor.
Authors
Juozas Baliuka, Chris Nokleberg, Eric Bruneton

Field Summary

Modifier and TypeField and Description
private final String
descriptor

The method descriptor.

private final String
name

The method name.

private static final Map<String, String>
PRIMITIVE_TYPE_DESCRIPTORS

The descriptors of the primitive Java types (plus void).

Constructor Summary

AccessConstructor and Description
public
Method(final String
the method's name.
name
,
final String
the method's descriptor.
descriptor
)

Constructs a new Method.

public
Method(final String
the method's name.
name
,
final Type
the method's return type.
returnType
,
final Type[]
the method's argument types.
argumentTypes
)

Constructs a new Method.

Method Summary

Modifier and TypeMethod and Description
public boolean
equals(final Object
the reference object with which to compare.
other
)

Overrides java.lang.Object.equals.

Indicates whether some other object is "equal to" this one.
public Type[]

Returns:

the argument types of the method described by this object.
getArgumentTypes
()

Returns the argument types of the method described by this object.

public String

Returns:

the descriptor of the method described by this object.
getDescriptor
()

Returns the descriptor of the method described by this object.

private static String

Returns:

the descriptor corresponding to the given type name.
getDescriptorInternal
(final String
a Java type name.
type
,
final boolean
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.
defaultPackage
)

Returns the descriptor corresponding to the given type name.

public static Method

Returns:

a Method corresponding to the given Java method declaration.
getMethod
(final Method
a java.lang.reflect method descriptor
method
)

Creates a new Method.

public static Method

Returns:

a Method corresponding to the given Java constructor declaration.
getMethod
(final Constructor<?>
a java.lang.reflect constructor descriptor
constructor
)

Creates a new Method.

public static Method

Returns:

a Method corresponding to the given Java method declaration.
getMethod
(final String
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
)

Returns a Method corresponding to the given Java method declaration.

public static Method

Returns:

a Method corresponding to the given Java method declaration.
getMethod
(final String
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.
method
,
final boolean
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.
defaultPackage
)

Returns a Method corresponding to the given Java method declaration.

public String

Returns:

the name of the method described by this object.
getName
()

Returns the name of the method described by this object.

public Type

Returns:

the return type of the method described by this object.
getReturnType
()

Returns the return type of the method described by this object.

public int
hashCode()

Overrides java.lang.Object.hashCode.

Returns a hash code value for the object.
public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.
Inherited from java.lang.Object:
clonefinalizegetClassnotifynotifyAllwaitwaitwait

Field Detail

descriptorback to summary
private final String descriptor

The method descriptor.

nameback to summary
private final String name

The method name.

PRIMITIVE_TYPE_DESCRIPTORSback to summary
private static final Map<String, String> PRIMITIVE_TYPE_DESCRIPTORS

The descriptors of the primitive Java types (plus void).

Constructor Detail

Methodback to summary
public Method(final String name, final String descriptor)

Constructs a new Method.

Parameters
name:String

the method's name.

descriptor:String

the method's descriptor.

Methodback to summary
public Method(final String name, final Type returnType, final Type[] argumentTypes)

Constructs a new Method.

Parameters
name:String

the method's name.

returnType:Type

the method's return type.

argumentTypes:Type[]

the method's argument types.

Method Detail

equalsback to summary
public boolean equals(final Object other)

Overrides java.lang.Object.equals.

Doc from java.lang.Object.equals.

Indicates whether some other object is "equal to" this one.

The equals method implements an equivalence relation on non-null object references:

  • It is reflexive: for any non-null reference value x, x.equals(x) should return true.
  • It is symmetric: for any non-null reference values x and y, x.equals(y) should return true if and only if y.equals(x) returns true.
  • It is transitive: for any non-null reference values x, y, and z, if x.equals(y) returns true and y.equals(z) returns true, then x.equals(z) should return true.
  • It is consistent: for any non-null reference values x and y, multiple invocations of x.equals(y) consistently return true or consistently return false, provided no information used in equals comparisons on the objects is modified.
  • For any non-null reference value x, x.equals(null) should return false.

An equivalence relation partitions the elements it operates on into equivalence classes; all the members of an equivalence class are equal to each other. Members of an equivalence class are substitutable for each other, at least for some purposes.

Parameters
other:Object

the reference object with which to compare.

Returns:boolean

true if this object is the same as the obj argument; false otherwise.

Annotations
@Override
getArgumentTypesback to summary
public Type[] getArgumentTypes()

Returns the argument types of the method described by this object.

Returns:Type[]

the argument types of the method described by this object.

getDescriptorback to summary
public String getDescriptor()

Returns the descriptor of the method described by this object.

Returns:String

the descriptor of the method described by this object.

getDescriptorInternalback to summary
private static String getDescriptorInternal(final String type, final boolean defaultPackage)

Returns the descriptor corresponding to the given type name.

Parameters
type:String

a Java type name.

defaultPackage:boolean

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:String

the descriptor corresponding to the given type name.

getMethodback to summary
public static Method getMethod(final Method method)

Creates a new Method.

Parameters
method:Method

a java.lang.reflect method descriptor

Returns:Method

a Method corresponding to the given Java method declaration.

getMethodback to summary
public static Method getMethod(final Constructor<?> constructor)

Creates a new Method.

Parameters
constructor:Constructor<?>

a java.lang.reflect constructor descriptor

Returns:Method

a Method corresponding to the given Java constructor declaration.

getMethodback to summary
public static Method getMethod(final String method)

Returns a Method corresponding to the given Java method declaration.

Parameters
method:String

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:Method

a Method corresponding to the given Java method declaration.

Exceptions
IllegalArgumentException:
if method could not get parsed.
getMethodback to summary
public static Method getMethod(final String method, final boolean defaultPackage)

Returns a Method corresponding to the given Java method declaration.

Parameters
method:String

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:boolean

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:Method

a Method corresponding to the given Java method declaration.

Exceptions
IllegalArgumentException:
if method could not get parsed.
getNameback to summary
public String getName()

Returns the name of the method described by this object.

Returns:String

the name of the method described by this object.

getReturnTypeback to summary
public Type getReturnType()

Returns the return type of the method described by this object.

Returns:Type

the return type of the method described by this object.

hashCodeback to summary
public int hashCode()

Overrides java.lang.Object.hashCode.

Doc from java.lang.Object.hashCode.

Returns a hash code value for the object. This method is supported for the benefit of hash tables such as those provided by java.util.HashMap.

The general contract of hashCode is:

  • Whenever it is invoked on the same object more than once during an execution of a Java application, the hashCode method must consistently return the same integer, provided no information used in equals comparisons on the object is modified. This integer need not remain consistent from one execution of an application to another execution of the same application.
  • If two objects are equal according to the equals method, then calling the hashCode method on each of the two objects must produce the same integer result.
  • It is not required that if two objects are unequal according to the equals method, then calling the hashCode method on each of the two objects must produce distinct integer results. However, the programmer should be aware that producing distinct integer results for unequal objects may improve the performance of hash tables.
Returns:int

a hash code value for this object.

Annotations
@Override
toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object.

Returns:String

a string representation of the object.

Annotations
@Override