public final class ReflectionHelper
extends java.lang.Object
| Modifier | Constructor and Description |
|---|---|
private |
ReflectionHelper()
Private constructor to prevent instances of this class from being
created.
|
| Modifier and Type | Method and Description |
|---|---|
static java.lang.String |
simpleName(java.lang.String full)
Removes all text up to and including the last '.' in the given string
and returns the remaining text.
|
static boolean |
testSignature(java.lang.Class[] possible,
java.lang.Class[] actual)
Compare signatures as described by two arrays of classes and report
if they are equivalent.
|
static java.lang.String |
toStringSignature(java.lang.String name,
java.lang.Class[] parms,
java.lang.Class returnType)
Create a string representing the signature of the described method.
|
private ReflectionHelper()
public static boolean testSignature(java.lang.Class[] possible,
java.lang.Class[] actual)
Class.getConstructor() and
Class.getMethod() don't check for assignability so
a signature based on child classes won't match a compatible signature
that uses super classes. The J2SE implementation uses a reference
comparison but this method uses isAssignableFrom.
A quick return occurs in any case where the number of parameters in the signatures are different.
possible - The candidate signature list.actual - The signature being searched for.true if the signatures are compatible.public static java.lang.String simpleName(java.lang.String full)
full - A fully qualified class or method name.public static java.lang.String toStringSignature(java.lang.String name,
java.lang.Class[] parms,
java.lang.Class returnType)
No modifiers are known so there will be no text like public
or static in the result.
name - The method name, inserted verbetim into the result.parms - The list of parameters. If null or 0 length,
then there are no parameters in the signature.returnType - The type the method returns. Use null to indicate
that the return type is unknown or irrelevent. Use
void.class for a void return.