Package org.proxy4j.core.reflect
Class SignatureKey
- java.lang.Object
-
- org.proxy4j.core.reflect.SignatureKey
-
- All Implemented Interfaces:
Comparable<SignatureKey>
public class SignatureKey extends Object implements Comparable<SignatureKey>
Represents a method key for methods within the same class hierarchy.
- Author:
- Brennan Spies
-
-
Constructor Summary
Constructors Constructor Description SignatureKey(Method method)Creates aSignatureKeyfrom the method.SignatureKey(String name, Class<?>... parameterTypes)Creates aSignatureKeyfrom the given name and parameter types.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description intcompareTo(SignatureKey other)Compares two signatures on method name, number of parameters, and finally the parameter types themselves.booleanequals(Object o)Equality of method signatures is done strictly on method name and parameter types.StringgetName()Gets the method name.Class<?>[]getParameterTypes()Gets the parameter types to the method.inthashCode()Returns the hash code.static Comparator<Method>methodComparator()Returns aComparatorthat compares two methods on the basis of their signatures.
-
-
-
Constructor Detail
-
SignatureKey
public SignatureKey(Method method)
Creates aSignatureKeyfrom the method.- Parameters:
method- The method from which to create the signature
-
-
Method Detail
-
methodComparator
public static Comparator<Method> methodComparator()
Returns aComparatorthat compares two methods on the basis of their signatures.- Returns:
- The method comparator
-
getName
public String getName()
Gets the method name.- Returns:
- The method name
-
getParameterTypes
public Class<?>[] getParameterTypes()
Gets the parameter types to the method.- Returns:
- The parameter types
-
equals
public boolean equals(Object o)
Equality of method signatures is done strictly on method name and parameter types.
-
hashCode
public int hashCode()
Returns the hash code.
-
compareTo
public int compareTo(SignatureKey other)
Compares two signatures on method name, number of parameters, and finally the parameter types themselves.- Specified by:
compareToin interfaceComparable<SignatureKey>- Parameters:
other- The other signature- Returns:
- 0 if equal, negative int if this is less than other, positive int if otherwise
-
-