public class Reflector extends Object
Property types: Normal=no-arg getter, indexed=single-int-arg getter, named=single- string- arg getter.
Modifier and Type | Field and Description |
---|---|
static neo.util.Reflector.PropertyType |
INDEXED
Deprecated.
|
static neo.util.Reflector.PropertyType |
NAMED
Deprecated.
|
static neo.util.Reflector.PropertyType |
NORMAL
Deprecated.
|
Modifier and Type | Method and Description |
---|---|
protected static String |
getBooleanGetterName(String property)
Deprecated.
|
static Class |
getContentType(Object o)
Deprecated.
returns the content type of any collection type.
|
static String |
getGetterName(String property)
Deprecated.
|
static int |
getLength(Object multiset)
Deprecated.
this getLength() is defined for:
null - 0
arrays - java.lang.reflect.Array.getLength()
Lists - list.size()
throws IllegalArgumentException if arg is none of these
|
static Method |
getMethod(String name,
Class[] args,
Object o)
Deprecated.
returns the method specified by the name and argument types.
|
static Class |
getPrimitiveType(Object o)
Deprecated.
returns the primitive type corresponding to a primitive object wrapper class (Integer.TYPE for Integers etc.).
|
static Object |
getProperty(String repr,
Object o)
Deprecated.
returns the specified property, possibly nested, on the argument object
|
static String |
getPropertyName(String methodName)
Deprecated.
returns a property name given a property method (getter or setter) name.
|
static String |
getSetterName(String prop)
Deprecated.
returns the name of the setter given the name of the property
ex.
|
static Class |
getType(Object o)
Deprecated.
returns the class of the argument object.
|
static String |
getTypeName(Object o)
Deprecated.
|
static List |
getTypeNames(Object[] args)
Deprecated.
|
static Class[] |
getTypes(Object[] args)
Deprecated.
as getType(), but for multiple arguments.
|
static boolean |
hasMethod(String name,
Class[] args,
Object o)
Deprecated.
|
static Object |
invoke(Method m,
Object[] args,
Object trgt)
Deprecated.
invokes the specified method, returning the method return value if any,
or null if none.
|
static Object |
invoke(String methodName,
Object[] args,
Object target)
Deprecated.
invokes the specified method with the specified args on the specified target.
|
static Object |
invoke(String methodName,
Object[] args,
String className)
Deprecated.
invokes the specified method with specified args.
|
static Object |
invoke(String methodName,
Object arg,
Object target)
Deprecated.
|
static Object |
invoke(String methodName,
Object arg1,
Object arg2,
Object target)
Deprecated.
|
static Object |
invokeSilently(String methodName,
Object[] args,
String className)
Deprecated.
as invoke(String, Object[], String), but does not throw exceptions if the call fails, returning null instead.
|
static boolean |
isArray(Object o)
Deprecated.
|
static boolean |
isCollection(Object o)
Deprecated.
a collection is an object type containing multiple elements, with no requirement for fixed order.
|
static boolean |
isSequence(Object o)
Deprecated.
a 'sequence' is an object type containing multiple elements in fixed order.
|
static boolean |
isType(Object sometype,
Class instOf)
Deprecated.
an instanceof for class args: is the first argument the same as or a subtype of
the second argument
|
static boolean |
isType(Object somevalue,
String classname)
Deprecated.
type check on classname.
|
static Object |
setProperty(String repr,
Object value,
Object root)
Deprecated.
sets the given property representation, from the specified root, to the given value;
returns the old value of the property
|
public static final neo.util.Reflector.PropertyType NORMAL
public static final neo.util.Reflector.PropertyType INDEXED
public static final neo.util.Reflector.PropertyType NAMED
public static final Method getMethod(String name, Class[] args, Object o)
public static Object invoke(Method m, Object[] args, Object trgt)
public static Object invoke(String methodName, Object[] args, Object target)
methodName
- - full static or instance method nameargs
- - method arguments if any, primitive args must be wrapped in their corresponding wrapper (Integer for int etc)
May be null if the method does not accept arguments.target
- - object on which to call the method. Has to be an object for instance methods,
and an object or class for static methods.IllegalStateException
- if the method is not found or cannot be invoked.
if the method throws an InvocationTargetException, the causing exception will be passed as argument.public static Object invoke(String methodName, Object arg1, Object arg2, Object target)
public static Object invoke(String methodName, Object[] args, String className)
methodName
- - name of the method (ex. 'getId')args
- - arguments to the method. may be null if there are no arguments.public static Object invokeSilently(String methodName, Object[] args, String className)
public static boolean isType(Object sometype, Class instOf)
public static boolean isType(Object somevalue, String classname)
public static int getLength(Object multiset)
public static Class getContentType(Object o)
public static String getSetterName(String prop)
public static String getPropertyName(String methodName)
public static Class getType(Object o)
o
- public static Class getPrimitiveType(Object o)
public static Class[] getTypes(Object[] args)
public static boolean isArray(Object o)
public static boolean isSequence(Object o)
public static boolean isCollection(Object o)
public static Object getProperty(String repr, Object o)
© 1998- 2018 Stibo DX