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