|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.thoughtworks.proxy.kit.ReflectionUtils
public class ReflectionUtils
Helper class for introspecting interface and class hierarchies.
| Field Summary | |
|---|---|
static Method |
equals
the Object.equals(Object) method. |
static Method |
hashCode
the Object.hashCode() method. |
static Method |
toString
the Object.toString() method. |
| Method Summary | |
|---|---|
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. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
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.
| Method Detail |
|---|
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 use
public static Method getMatchingMethod(Class<?> type,
String methodName,
Object[] args)
throws NoSuchMethodException
type - the typemethodName - the name of the method to searchargs - the arguments to match
Method
NoSuchMethodException - if no matching Method exists
public static void writeMethod(ObjectOutputStream out,
Method method)
throws IOException
Method into an ObjectOutputStream.
out - the streammethod - the Method to write
IOException - if writing causes a problem
public static Method readMethod(ObjectInputStream in)
throws IOException,
ClassNotFoundException
Method from an ObjectInputStream.
in - the stream
Method
IOException - if reading causes a problem
ClassNotFoundException - if class types from objects of the InputStream cannot be found
InvalidObjectException - if the Method cannot be found
public static Class<?>[] makeTypesArray(Class<?> primaryType,
Class<?>[] types)
primaryType - the primary typestypes - the additional types (may be null)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||