|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjfun.yan.Functions
public final class Functions
This is the facade class to create different Function objects.
throughout this class, when searching reflection objects, public members are defined as members defined with "public" keyword and declared in a public type. public members declared by a non-public class is considered non-public because access to it from outside is prohibited by the java access control anyway.
public members defined in public classes are always prefered even when we allow private/protected members and types to be visible. So if a non-public subtype and a public super type both have a field with the same name, the field in the public super type is always used.
Codehaus.org.
| Constructor Summary | |
|---|---|
Functions()
|
|
| Method Summary | ||
|---|---|---|
static
|
ctor(java.lang.Class<T> c)
Create a Function object that uses the public constructor of a class. |
|
static
|
ctor(java.lang.Class<T> c,
boolean suppress_security)
Create a Function object that uses the constructor of a class. |
|
static
|
ctor(java.lang.Class<T> c,
java.lang.Class[] param_types)
Create a Function object that uses one public constructor of a class. |
|
static
|
ctor(java.lang.Class<T> c,
java.lang.Class[] param_types,
boolean suppress_security)
Create a Function object that uses one constructor of a class. |
|
static
|
ctor(java.lang.reflect.Constructor<T> ctor)
Adapts a Constructor object
to a Function object. |
|
static Function |
field(java.lang.Class type,
java.lang.Object obj,
java.lang.String name)
Create a Function object that reads a public field from a given object. |
|
static Function |
field(java.lang.Class type,
java.lang.Object obj,
java.lang.String name,
boolean suppress_security)
Create a Function object that reads a field from a given object. |
|
static Function |
field(java.lang.Object obj,
java.lang.reflect.Field fld)
Adapts a Field object and the receiver object
to a Function object. |
|
static Function |
field(java.lang.Object obj,
java.lang.String name)
Create a Function object that reads a public field from a given object. |
|
static Function |
field(java.lang.Object obj,
java.lang.String name,
boolean suppress_security)
Create a Function object that reads a field from a given object. |
|
static Function |
getter(Bean bean,
java.lang.String name)
Creates a Function object that invokes a property getter. |
|
static Function |
indexed_getter(Bean bean,
java.lang.String name,
int ind)
Creates a Function object that invokes an indexed property getter. |
|
static Function |
indexed_setter(Bean bean,
java.lang.String name,
int ind)
Creates a Function object that invokes an indexed property setter. |
|
static Function |
instance_field(java.lang.Class c,
java.lang.reflect.Field fld)
Create a Function object that reads an instance field. |
|
static Function |
instance_field(java.lang.Class c,
java.lang.String name)
Create a Function object that reads a public instance field. |
|
static Function |
instance_field(java.lang.Class c,
java.lang.String name,
boolean suppress_security)
Create a Function object that reads an instance field. |
|
static Function |
instance_method(java.lang.Class c,
java.lang.reflect.Method mtd)
Create a Function object that invokes an instance method. |
|
static Function |
instance_method(java.lang.Class c,
java.lang.String name)
Create a Function object that invokes a public instance method. |
|
static Function |
instance_method(java.lang.Class c,
java.lang.String name,
boolean suppress_security)
Create a Function object that invokes an instance method. |
|
static Function |
instance_method(java.lang.Class c,
java.lang.String name,
java.lang.Class[] param_types)
Create a Function object that invokes a public instance method. |
|
static Function |
instance_method(java.lang.Class c,
java.lang.String name,
java.lang.Class[] param_types,
boolean suppress_security)
Create a Function object that invokes an instance method. |
|
static Function |
method(java.lang.Class type,
java.lang.Object obj,
java.lang.String name)
Create a Function object that invokes a public method against a given object. |
|
static Function |
method(java.lang.Class type,
java.lang.Object obj,
java.lang.String name,
boolean suppress_security)
Create a Function object that invokes a method against a given object. |
|
static Function |
method(java.lang.Class type,
java.lang.Object obj,
java.lang.String name,
java.lang.Class[] param_types)
Create a Function object that invokes a public method against a given object. |
|
static Function |
method(java.lang.Class type,
java.lang.Object obj,
java.lang.String name,
java.lang.Class[] param_types,
boolean suppress_security)
Create a Function object that invokes a method against a given object. |
|
static Function |
method(java.lang.Object obj,
java.lang.reflect.Method mtd)
Adapts a Method object and the receiver object
to a Function object. |
|
static Function |
method(java.lang.Object obj,
java.lang.String name)
Create a Function object that invokes a public method against a given object. |
|
static Function |
method(java.lang.Object obj,
java.lang.String name,
boolean suppress_security)
Create a Function object that invokes a method against a given object. |
|
static Function |
method(java.lang.Object obj,
java.lang.String name,
java.lang.Class[] param_types)
Create a Function object that invokes a public method against a given object. |
|
static Function |
method(java.lang.Object obj,
java.lang.String name,
java.lang.Class[] param_types,
boolean suppress_security)
Create a Function object that invokes a method against a given object. |
|
static Function |
setter(Bean bean,
java.lang.String name)
Creates a Function object that invokes a property setter. |
|
static Function |
static_field(java.lang.Class c,
java.lang.String name)
Create a Function object that reads a public static field. |
|
static Function |
static_field(java.lang.Class c,
java.lang.String name,
boolean suppress_security)
Create a Function object that reads a static field. |
|
static Function |
static_field(java.lang.reflect.Field fld)
Create a Function object that reads a static field. |
|
static Function |
static_method(java.lang.Class c,
java.lang.String name)
Create a Function object that invokes a public static method. |
|
static Function |
static_method(java.lang.Class c,
java.lang.String name,
boolean suppress_security)
Create a Function object that invokes a static method. |
|
static Function |
static_method(java.lang.Class c,
java.lang.String name,
java.lang.Class[] param_types)
Create a Function object that invokes a public static method. |
|
static Function |
static_method(java.lang.Class c,
java.lang.String name,
java.lang.Class[] param_types,
boolean suppress_security)
Create a Function object that invokes a static method. |
|
static Function |
static_method(java.lang.reflect.Method mtd)
Create a Function object that invokes a static method. |
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public Functions()
| Method Detail |
|---|
public static <T> Function<T> ctor(java.lang.reflect.Constructor<T> ctor)
Constructor object
to a Function object.
ctor - the constructor object.
public static Function method(java.lang.Object obj,
java.lang.reflect.Method mtd)
Method object and the receiver object
to a Function object.
obj - the receiver object to call the method against.
If the method is static, the object can be null.mtd - the method object.
public static <T> Function<T> ctor(java.lang.Class<T> c)
throws java.lang.IllegalArgumentException
c - the class.
java.lang.IllegalArgumentException - if the class has no public constructor
or has more than one public constructor.
public static <T> Function<T> ctor(java.lang.Class<T> c,
boolean suppress_security)
throws java.lang.IllegalArgumentException
c - the class.suppress_security - whether access to non-public members is allowed.
java.lang.IllegalArgumentException - if the class has no public constructor
or has more than one public constructor.
public static <T> Function<T> ctor(java.lang.Class<T> c,
java.lang.Class[] param_types)
c - the class.param_types - the parameter types of the constructor to use.
null indicates the default constructor.
java.lang.IllegalArgumentException - if the public constructor cannot be found.
public static <T> Function<T> ctor(java.lang.Class<T> c,
java.lang.Class[] param_types,
boolean suppress_security)
throws java.lang.IllegalArgumentException
c - the class.param_types - the parameter types of the constructor to use.suppress_security - whether access to non-public member is allowed.
null indicates the default constructor.
java.lang.IllegalArgumentException - if the public constructor cannot be found.
public static Function static_method(java.lang.Class c,
java.lang.String name)
c - the class where the static method belongs.name - the static method name.
java.lang.IllegalArgumentException - thrown if any of the following conditions is true:
public static Function static_method(java.lang.Class c,
java.lang.String name,
boolean suppress_security)
c - the class where the static method belongs.name - the static method name.suppress_security - whether to look at non-public methods.
java.lang.IllegalArgumentException - thrown if any of the following conditions is true:
public static Function static_method(java.lang.Class c,
java.lang.String name,
java.lang.Class[] param_types)
c - the class where the static method belongs.name - the static method name.param_types - the parameter types.
null indicates a parameter-less method.
java.lang.IllegalArgumentException - thrown if any of the following conditions is true:
public static Function static_method(java.lang.Class c,
java.lang.String name,
java.lang.Class[] param_types,
boolean suppress_security)
throws java.lang.IllegalArgumentException
c - the class where the static method belongs.name - the static method name.param_types - the parameter types.
null indicates a parameter-less method.suppress_security - whether to look at non-public methods.
java.lang.IllegalArgumentException - thrown if any of the following conditions is true: public static Function static_method(java.lang.reflect.Method mtd)
mtd - the method.
java.lang.IllegalArgumentException - thrown if this method is not static.
public static Function instance_method(java.lang.Class c,
java.lang.String name)
c - the class where the instance method belongs.name - the instance method name.
java.lang.IllegalArgumentException - thrown if any of the following conditions is true:
public static Function instance_method(java.lang.Class c,
java.lang.String name,
boolean suppress_security)
throws java.lang.IllegalArgumentException
c - the class where the instance method belongs.name - the instance method name.suppress_security - whether to look at non-public methods.
java.lang.IllegalArgumentException - thrown if any of the following conditions is true:
public static Function instance_method(java.lang.Class c,
java.lang.String name,
java.lang.Class[] param_types)
c - the class where the instance method belongs.name - the method name.param_types - the parameter types.
null indicates a parameter-less method.
java.lang.IllegalArgumentException - thrown if any of the following conditions is true:
public static Function instance_method(java.lang.Class c,
java.lang.String name,
java.lang.Class[] param_types,
boolean suppress_security)
throws java.lang.IllegalArgumentException
c - the class where the instance method belongs.name - the method name.param_types - the parameter types.suppress_security - whether to look at non-public ones.
null indicates a parameter-less method.
java.lang.IllegalArgumentException - thrown if any of the following conditions is true:
public static Function instance_method(java.lang.Class c,
java.lang.reflect.Method mtd)
c - the class where the instance method belongs.mtd - the method.
java.lang.IllegalArgumentException - thrown if this method is static.
public static Function method(java.lang.Object obj,
java.lang.String name)
obj - the object to run the method against. It cannot be null.name - the method name.
java.lang.IllegalArgumentException - thrown if any of the following conditions is true:
public static Function method(java.lang.Object obj,
java.lang.String name,
boolean suppress_security)
obj - the object to run the method against. It cannot be null.name - the method name.suppress_security - whether to look at non-public ones.
java.lang.IllegalArgumentException - thrown if any of the following conditions is true:
public static Function method(java.lang.Class type,
java.lang.Object obj,
java.lang.String name)
type - the Class object to look up method.
This parameter can be used when we only want to look up in
a super type rather than obj.getClass().obj - the object to run the method against.name - the method name.
java.lang.IllegalArgumentException - thrown if any of the following conditions is true:
public static Function method(java.lang.Class type,
java.lang.Object obj,
java.lang.String name,
boolean suppress_security)
type - the Class object to look up method.
This parameter can be used when we only want to look up in
a super type rather than obj.getClass().obj - the object to run the method against.name - the method name.suppress_security - whether to look at non-public ones.
java.lang.IllegalArgumentException - thrown if any of the following conditions is true:
public static Function method(java.lang.Object obj,
java.lang.String name,
java.lang.Class[] param_types)
obj - the object to run the method against. It cannot be null.name - the method name.param_types - the parameter types.
null indicates a parameter-less method.
java.lang.IllegalArgumentException - thrown if any of the following conditions is true:
public static Function method(java.lang.Object obj,
java.lang.String name,
java.lang.Class[] param_types,
boolean suppress_security)
obj - the object to run the method against. It cannot be null.name - the method name.param_types - the parameter types.suppress_security - whether to look at non-public ones.
null indicates a parameter-less method.
java.lang.IllegalArgumentException - thrown if any of the following conditions is true:
public static Function method(java.lang.Class type,
java.lang.Object obj,
java.lang.String name,
java.lang.Class[] param_types)
type - the Class object to look up method.
This parameter can be used when we only want to look up in
a super type rather than obj.getClass().obj - the object to run the method against. It cannot be null.name - the method name.param_types - the parameter types.
null indicates a parameter-less method.
java.lang.IllegalArgumentException - thrown if any of the following conditions is true:
public static Function method(java.lang.Class type,
java.lang.Object obj,
java.lang.String name,
java.lang.Class[] param_types,
boolean suppress_security)
type - the Class object to look up method.
This parameter can be used when we only want to look up in
a super type rather than obj.getClass().obj - the object to run the method against. It cannot be null.name - the method name.param_types - the parameter types.
null indicates a parameter-less method.suppress_security - whether to look at non-public ones.
java.lang.IllegalArgumentException - thrown if any of the following conditions is true:
public static Function getter(Bean bean,
java.lang.String name)
bean - the bean object.name - the property name.
public static Function indexed_getter(Bean bean,
java.lang.String name,
int ind)
bean - the bean object.name - the property name.ind - the index.
public static Function setter(Bean bean,
java.lang.String name)
bean - the bean object.name - the property name.
public static Function indexed_setter(Bean bean,
java.lang.String name,
int ind)
bean - the bean object.name - the property name.ind - the index.
public static Function static_field(java.lang.Class c,
java.lang.String name)
c - the class where the static field belongs.name - the static field name.
java.lang.IllegalArgumentException - thrown if any of the following conditions is true:
public static Function static_field(java.lang.Class c,
java.lang.String name,
boolean suppress_security)
c - the class where the static field belongs.name - the static field name.
java.lang.IllegalArgumentException - thrown if any of the following conditions is true: public static Function static_field(java.lang.reflect.Field fld)
fld - the field.
java.lang.IllegalArgumentException - thrown if this field is not static.
public static Function instance_field(java.lang.Class c,
java.lang.String name)
c - the class where the instance field belongs.name - the instance field name.
java.lang.IllegalArgumentException - thrown if any of the following conditions is true:
public static Function instance_field(java.lang.Class c,
java.lang.String name,
boolean suppress_security)
throws java.lang.IllegalArgumentException
c - the class where the instance field belongs.name - the instance field name.suppress_security - whether to look at non-public ones.
java.lang.IllegalArgumentException - thrown if any of the following conditions is true:
public static Function instance_field(java.lang.Class c,
java.lang.reflect.Field fld)
c - the class where the instance field belongs.fld - the field.
java.lang.IllegalArgumentException - thrown if this field is static.
public static Function field(java.lang.Object obj,
java.lang.String name)
obj - the object to read the field from. It cannot be null.name - the field name.
java.lang.IllegalArgumentException - thrown if any of the following conditions is true:
public static Function field(java.lang.Object obj,
java.lang.String name,
boolean suppress_security)
obj - the object to read the field from. It cannot be null.name - the field name.suppress_security - whether to look at non-public ones.
java.lang.IllegalArgumentException - thrown if any of the following conditions is true:
public static Function field(java.lang.Class type,
java.lang.Object obj,
java.lang.String name)
type - the Class object to look up field.
This parameter can be used when we only want to look up in
a super type rather than obj.getClass().obj - the object to read field from.name - the field name.
java.lang.IllegalArgumentException - thrown if any of the following conditions is true:
public static Function field(java.lang.Class type,
java.lang.Object obj,
java.lang.String name,
boolean suppress_security)
type - the Class object to look up field.
This parameter can be used when we only want to look up in
a super type rather than obj.getClass().obj - the object to read field from.name - the field name.suppress_security - whether to look at non-public ones.
java.lang.IllegalArgumentException - thrown if any of the following conditions is true:
public static Function field(java.lang.Object obj,
java.lang.reflect.Field fld)
Field object and the receiver object
to a Function object.
obj - the receiver object to read the field from.
If the field is static, the object can be null.fld - the field object.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||