|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectnl.tudelft.simulation.language.reflection.ClassUtil
public final class ClassUtil
ClassUtil is a utility class providing assistance for Java Classes.
(c) copyright 2002-2005 Delft University of Technology , the Netherlands.
See for project information www.simulation.tudelft.nl/language
License of use: Lesser
General Public License (LGPL) , no warranty
| Method Summary | |
|---|---|
static Constructor[] |
getAllConstructors(Class clazz,
Constructor[] result)
gets all the constructors of a class and adds the result to result |
static Method[] |
getAllMethods(Class clazz,
String name,
Method[] result)
gets all the methods of a class and adds the result to result |
static Class[] |
getClass(Object[] array)
converts an array of objects to their corresponding classes |
static boolean |
isMoreSpecific(Class[] a,
Class[] b)
Determines & returns whether constructor 'a' is more specific than constructor 'b', as defined in the Java Language Specification §15.12. |
static boolean |
isMoreSpecific(Constructor a,
Constructor b)
Determines & returns whether constructor 'a' is more specific than constructor 'b', as defined in the Java Language Specification §15.12. |
static boolean |
isMoreSpecific(Method a,
Method b)
Determines & returns whether constructor 'a' is more specific than constructor 'b', as defined in the Java Language Specification §15.12. |
static boolean |
isVisible(Constructor constructor,
Class caller)
Returns whether a constructor is visible for a caller. |
static boolean |
isVisible(Field field,
Class caller)
Returns whether a field is visible for a caller. |
static boolean |
isVisible(int modifiers,
Class declaringClass,
Class caller)
Returns whether a declaringClass is accessible according to the modifiers |
static boolean |
isVisible(Method method,
Class caller)
Returns whether a method is visible for a caller. |
static Constructor[] |
matchSignature(Constructor[] constructors,
Class[] argTypes)
Filters an array methods for signatures that are compatible with a given signature. |
static boolean |
matchSignature(Constructor constructor,
Class[] argTypes)
Filters an array methods for signatures that are compatible with a given signature. |
static Method[] |
matchSignature(Method[] methods,
String name,
Class[] argTypes)
Filters an array methods for signatures that are compatible with a given signature. |
static boolean |
matchSignature(Method method,
String name,
Class[] argTypes)
Filters an array methods for signatures that are compatible with a given signature. |
static Constructor |
resolveConstructor(Class clazz,
Class[] parameterTypes)
returns the interface method |
static Constructor |
resolveConstructor(Class clazz,
Class callerClass,
Class[] parameterTypes)
returns the interface method |
static Constructor |
resolveConstructor(Class clazz,
Object[] arguments)
returns the constructor |
static Field |
resolveField(Class clazz,
Class callerClass,
String name)
returns the field |
static Field |
resolveField(Class clazz,
String fieldName)
resolves the field for a class, taking into account inner classes |
static Field |
resolveField(Object object,
String fieldName)
resolves the field for a given object instance |
static Method |
resolveMethod(Class clazz,
Class callerClass,
String name,
Class[] parameterTypes)
returns the interface method |
static Method |
resolveMethod(Class clazz,
String name,
Class[] parameterTypes)
returns the interface method |
static Method |
resolveMethod(Object object,
String name,
Class[] parameterTypes)
resolves a method the method |
static Method |
resolveMethod(Object object,
String name,
Object[] arguments)
returns the method |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method Detail |
|---|
public static Constructor[] getAllConstructors(Class clazz,
Constructor[] result)
clazz - the classresult - the resulting set
public static Constructor resolveConstructor(Class clazz,
Class callerClass,
Class[] parameterTypes)
throws NoSuchMethodException
clazz - the class to start withcallerClass - the calling classparameterTypes - the parameterTypes
NoSuchMethodException - if the method cannot be resolved
public static Constructor resolveConstructor(Class clazz,
Class[] parameterTypes)
throws NoSuchMethodException
clazz - the class to start withparameterTypes - the parameterTypes
NoSuchMethodException - if the method cannot be resolved
public static Constructor resolveConstructor(Class clazz,
Object[] arguments)
throws NoSuchMethodException
clazz - the clazz to start witharguments - the arguments
NoSuchMethodException - on lookup failure
public static Field resolveField(Class clazz,
String fieldName)
throws NoSuchFieldException
clazz - the class to resolve the field for, including inner classesfieldName - name of the field
NoSuchFieldException - on no such field
public static Field resolveField(Class clazz,
Class callerClass,
String name)
throws NoSuchFieldException
clazz - the class to start withcallerClass - the calling classname - the fieldName
NoSuchFieldException - if the method cannot be resolved
public static Field resolveField(Object object,
String fieldName)
throws NoSuchFieldException
object - the object to resolve the field forfieldName - name of the field to resolve
NoSuchFieldException - if the field cannot be resolved
public static Method[] getAllMethods(Class clazz,
String name,
Method[] result)
clazz - the classname - the name of the methodresult - the resulting set
public static Method resolveMethod(Class clazz,
Class callerClass,
String name,
Class[] parameterTypes)
throws NoSuchMethodException
clazz - the class to start withcallerClass - the caller classname - the name of the methodparameterTypes - the parameterTypes
NoSuchMethodException - on lookup failure
public static Method resolveMethod(Class clazz,
String name,
Class[] parameterTypes)
throws NoSuchMethodException
clazz - the class to start withname - the name of the methodparameterTypes - the parameterTypes
NoSuchMethodException - on lookup failure
public static Method resolveMethod(Object object,
String name,
Class[] parameterTypes)
throws NoSuchMethodException
object - the object to start withname - the name of the methodparameterTypes - the parameterTypes
NoSuchMethodException - on lookup failure
public static Method resolveMethod(Object object,
String name,
Object[] arguments)
throws NoSuchMethodException
object - the object to start withname - the name of the methodarguments - the arguments
NoSuchMethodException - on lookup failure
public static boolean isVisible(int modifiers,
Class declaringClass,
Class caller)
modifiers - the modifiersdeclaringClass - the declaringClasscaller - the caller
public static boolean isMoreSpecific(Class[] a,
Class[] b)
a - reflects the first constructorb - reflects the second constructor
public static boolean isMoreSpecific(Constructor a,
Constructor b)
a - reflects the first constructorb - reflects the second constructor
public static boolean isMoreSpecific(Method a,
Method b)
a - reflects the first methodb - reflects the second method
public static boolean isVisible(Field field,
Class caller)
field - The fieldcaller - The class of the caller for whom invocation visibility is
checked.
public static boolean isVisible(Constructor constructor,
Class caller)
constructor - The constructorcaller - The class of the caller for whom invocation visibility is
checked.
public static boolean isVisible(Method method,
Class caller)
method - The methodcaller - The class of the caller for whom invocation visibility is
checked.
public static Method[] matchSignature(Method[] methods,
String name,
Class[] argTypes)
methods - which are methods to be filtered.name - reflects the method's name, part of the signatureargTypes - are the method's argument types
public static boolean matchSignature(Method method,
String name,
Class[] argTypes)
method - The method to be filtered.name - reflects the method's name, part of the signatureargTypes - are the method's argument types
public static boolean matchSignature(Constructor constructor,
Class[] argTypes)
constructor - which are constructors to be filtered.argTypes - are the constructor's argument types
public static Constructor[] matchSignature(Constructor[] constructors,
Class[] argTypes)
constructors - which are constructors to be filtered.argTypes - are the constructor's argument types
public static Class[] getClass(Object[] array)
array - the array to invoke
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||