| java.lang.Object uk.org.ponder.reflect.ReflectUtils
ReflectUtils | public class ReflectUtils (Code) | | author: Antranig Basman (antranig@caret.cam.ac.uk) |
Method Summary | |
public static void | addStaticStrings(Object provider, String xfix, boolean prefix, StringList strings) | public static Method[] | getMatchingMethods(Class clazz, String methodname, Object[] args) | public static List | getSuperclasses(Class clazz) Returns a list of all superclasses and implemented interfaces by the
supplied class, recursively to the base, up to but excluding Object.class. | public static int | getTypeDifferenceWeight(Class[] argTypes, Object[] args) Determine a weight that represents the class hierarchy difference between
types and arguments. | public static boolean | hasMethod(Object obj, String methodname) Determines whether an object is capable of supporting a method invocation
with a given name. | public static Object | instantiateContainer(Class declaredtype, int size, ReflectiveCache cache) Instantiates a "default" type of container conforming to a given interface
and of a given size. | public static boolean | isAssignable(Class type, Object value) Determine if the given type is assignable from the given value, assuming
setting by reflection. | public static boolean | isAssignable(Class declaredType, Class objectType) Determine if the given target type is assignable from the given value type,
assuming setting by reflection. | public static boolean | isPublicStatic(int modifiers) |
PREFIX | final public static boolean PREFIX(Code) | | |
SUFFIX | final public static boolean SUFFIX(Code) | | |
UNKNOWN_SIZE | final public static int UNKNOWN_SIZE(Code) | | |
getSuperclasses | public static List getSuperclasses(Class clazz)(Code) | | Returns a list of all superclasses and implemented interfaces by the
supplied class, recursively to the base, up to but excluding Object.class.
These will be listed in order from the supplied class, all concrete
superclasses in ascending order, and then finally all interfaces in
recursive ascending order.
|
getTypeDifferenceWeight | public static int getTypeDifferenceWeight(Class[] argTypes, Object[] args)(Code) | | Determine a weight that represents the class hierarchy difference between
types and arguments. A direct match, i.e. type Integer -> arg of class
Integer, does not increase the result - all direct matches means weight 0.
A match between type Object and arg of class Integer would increase the
weight by 2, due to the superclass 2 steps up in the hierarchy (i.e.
Object) being the last one that still matches the required type Object.
Type Number and class Integer would increase the weight by 1 accordingly,
due to the superclass 1 step up the hierarchy (i.e. Number) still matching
the required type Number. Therefore, with an arg of type Integer, a
constructor (Integer) would be preferred to a constructor (Number) which
would in turn be preferred to a constructor (Object). All argument weights
get accumulated.
This method will assign a penalty of 1024 to an invocation that would
require a type conversion (currently only default leaf conversions from String
are considered)
This method adapted from Spring framework AutowireUtils.java release version
2.0.5
author: Juergen Hoeller Parameters: argTypes - the argument types to match Parameters: args - the arguments to match the accumulated weight for all arguments |
hasMethod | public static boolean hasMethod(Object obj, String methodname)(Code) | | Determines whether an object is capable of supporting a method invocation
with a given name. Used primarily to resolve potential ambiguity in EL
expressions that are being interpreted as method bindings.
|
instantiateContainer | public static Object instantiateContainer(Class declaredtype, int size, ReflectiveCache cache)(Code) | | Instantiates a "default" type of container conforming to a given interface
and of a given size. If asked to create an array of unknown size, will
return an zero-element array instead, signalling a "placeholder".
|
isAssignable | public static boolean isAssignable(Class type, Object value)(Code) | | Determine if the given type is assignable from the given value, assuming
setting by reflection. Considers primitive wrapper classes as assignable to
the corresponding primitive types. For example used in a bean factory's
constructor resolution. Taken from Spring Framework "BeanUtils.java"
release version 2.0.5
author: Rod Johnson author: Juergen Hoeller author: Rob Harrop Parameters: type - the target type Parameters: value - the value that should be assigned to the type if the type is assignable from the value |
isAssignable | public static boolean isAssignable(Class declaredType, Class objectType)(Code) | | Determine if the given target type is assignable from the given value type,
assuming setting by reflection. Considers primitive wrapper classes as
assignable to the corresponding primitive types.
Parameters: declaredType - the target type Parameters: objectType - the value type that should be assigned to the target type if the target type is assignable from the value type |
isPublicStatic | public static boolean isPublicStatic(int modifiers)(Code) | | |
|
|