Package com.globalmentor.java
Class MethodSignature
java.lang.Object
com.globalmentor.model.AbstractHashObject
com.globalmentor.java.MethodSignature
A lightweight encapsulation of a method's signature, without regard to its access restrictions or the class to which it belongs. The signature instance
supports
hashCode()
and equals(Object)
.- Author:
- Garret Wilson
-
Method Summary
Modifier and TypeMethodDescriptionboolean
Determines if this object equals another object.static MethodSignature
Creates and returns a method signature from the given method.static MethodSignature
Creates and returns a method signature from the given method.getName()
Class<?>
int
hashCode()
Returns the hash code of this object.boolean
Methods inherited from class com.globalmentor.model.AbstractHashObject
toString
-
Method Details
-
getName
- Returns:
- The name of the method.
-
getReturnType
- Returns:
- The return type of the method.
-
getParameterTypes
- Returns:
- The parameter types of the method.
-
isReturnTypeSignificant
public boolean isReturnTypeSignificant()- Returns:
- Whether, for purposes of equality, the return type is significant.
-
hashCode
public int hashCode()Description copied from class:AbstractHashObject
Returns the hash code of this object. This version returns the hash code of the underlying objects.- Overrides:
hashCode
in classAbstractHashObject
- Returns:
- The hash code of this object.
-
equals
Description copied from class:AbstractHashObject
Determines if this object equals another object. This version considers the given object equal to this object if it is of the same type as this object, and this object's decorated object'sObject.equals(Object)
method also returnstrue
for the objects's decorated object or both decorated objects arenull
.- Overrides:
equals
in classAbstractHashObject
- Parameters:
object
- The object to compare with this object.- Returns:
true
if the given object is considered equal to this object.
-
forMethod
Creates and returns a method signature from the given method. The return type is considered significant for purposes of equality.- Parameters:
method
- The method for which a signature should be returned.- Returns:
- An object representing the signature of the given methods.
-
forMethod
Creates and returns a method signature from the given method.- Parameters:
method
- The method for which a signature should be returned.returnTypeSignificant
- Whether, for purposes of equality, the return type is significant.- Returns:
- An object representing the signature of the given methods.
-