public class ReflectionUtils
extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
static java.lang.reflect.Method |
equals
the
Object.equals(Object) method. |
static java.lang.reflect.Method |
hashCode
the
Object.hashCode() method. |
static java.lang.reflect.Method |
toString
the
Object.toString() method. |
| Modifier | Constructor and Description |
|---|---|
private |
ReflectionUtils()
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
static void |
addIfClassProxyingSupportedAndNotObject(java.lang.Class<?> type,
java.util.Set<java.lang.Class<?>> interfaces,
ProxyFactory proxyFactory)
Add the given type to the set of interfaces, if the given ProxyFactory supports proxy generation for this type.
|
static java.util.Set<java.lang.Class<?>> |
getAllInterfaces(java.lang.Class<?> type)
Get all interfaces of the given type.
|
static java.util.Set<java.lang.Class<?>> |
getAllInterfaces(java.lang.Object... objects)
Get all the interfaces implemented by a list of objects.
|
private static void |
getInterfaces(java.lang.Class<?> type,
java.util.Set<java.lang.Class<?>> interfaces) |
static java.lang.reflect.Method |
getMatchingMethod(java.lang.Class<?> type,
java.lang.String methodName,
java.lang.Object[] args)
Get the method of the given type, that has matching parameter types to the given arguments.
|
static java.lang.Class<?> |
getMostCommonSuperclass(java.lang.Object... objects)
Get most common superclass for all given objects.
|
static java.lang.Class<?>[] |
makeTypesArray(java.lang.Class<?> primaryType,
java.lang.Class<?>[] types)
Create an array of types.
|
static java.lang.reflect.Method |
readMethod(java.io.ObjectInputStream in)
Read a
Method from an ObjectInputStream. |
static void |
writeMethod(java.io.ObjectOutputStream out,
java.lang.reflect.Method method)
Write a
Method into an ObjectOutputStream. |
public static final java.lang.reflect.Method equals
Object.equals(Object) method.public static final java.lang.reflect.Method hashCode
Object.hashCode() method.public static final java.lang.reflect.Method toString
Object.toString() method.private ReflectionUtils()
public static java.util.Set<java.lang.Class<?>> getAllInterfaces(java.lang.Object... objects)
objects - the list of objects to consider.public static java.util.Set<java.lang.Class<?>> getAllInterfaces(java.lang.Class<?> type)
type - type to explore.Set with all interfaces. The set may be empty.private static void getInterfaces(java.lang.Class<?> type,
java.util.Set<java.lang.Class<?>> interfaces)
public static java.lang.Class<?> getMostCommonSuperclass(java.lang.Object... objects)
objects - the array of objects to consider.Void.class for an empty array.public static void addIfClassProxyingSupportedAndNotObject(java.lang.Class<?> type,
java.util.Set<java.lang.Class<?>> interfaces,
ProxyFactory proxyFactory)
type - the class type (Object.class will be ignored)interfaces - the set of interfacesproxyFactory - the ProxyFactory in usepublic static java.lang.reflect.Method getMatchingMethod(java.lang.Class<?> type,
java.lang.String methodName,
java.lang.Object[] args)
throws java.lang.NoSuchMethodException
type - the typemethodName - the name of the method to searchargs - the arguments to matchMethodjava.lang.NoSuchMethodException - if no matching Method existspublic static void writeMethod(java.io.ObjectOutputStream out,
java.lang.reflect.Method method)
throws java.io.IOException
Method into an ObjectOutputStream.out - the streammethod - the Method to writejava.io.IOException - if writing causes a problempublic static java.lang.reflect.Method readMethod(java.io.ObjectInputStream in)
throws java.io.IOException,
java.lang.ClassNotFoundException
Method from an ObjectInputStream.in - the streamMethodjava.io.IOException - if reading causes a problemjava.lang.ClassNotFoundException - if class types from objects of the InputStream cannot be foundjava.io.InvalidObjectException - if the Method cannot be foundpublic static java.lang.Class<?>[] makeTypesArray(java.lang.Class<?> primaryType,
java.lang.Class<?>[] types)
primaryType - the primary typestypes - the additional types (may be null)