|
![]() |
|||||||||
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 clazz,
Set interfaces,
ProxyFactory proxyFactory)
Add the given type to the set of interfaces, if the given ProxyFactory supports proxy generation for this type. |
static Set |
getAllInterfaces(Class clazz)
Get all interfaces of the given type. |
static Set |
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 Method |
readMethod(ObjectInputStream in)
Read a Method from an ObjectInputStream . |
static Class[] |
toClassArray(Collection collection)
Convert the collection of class types to an array of class types. |
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 getAllInterfaces(Object[] objects)
objects
- the list of objects to consider.
public static Set getAllInterfaces(Class clazz)
clazz
- 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 clazz, Set interfaces, ProxyFactory proxyFactory)
clazz
- the class type (Object.class
will be ignored)interfaces
- the set of interfacesproxyFactory
- the ProxyFactory
in usepublic static Class[] toClassArray(Collection collection)
collection
- with class types
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
existspublic 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 problempublic 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
|
![]() |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |