jfun.yan
Class Components

java.lang.Object
  extended by jfun.yan.Components

public final class Components
extends java.lang.Object

This class provides implementations of some basic components as well as most of the commonly used combiniators for Component. A combinator is a function that will combine one or more Component objects and create a more complex Component object.

Codehaus.org.

Author:
Ben Yu

Constructor Summary
Components()
           
 
Method Summary
static
<T> Component<T>
adapt(Creator<T> c)
          To adapt a Creator object to a Component object.
static
<T> Component<T[]>
array(Component<T>... ccs)
          Create a Component object that creates an array as instance.
static
<T> Component<T[]>
array(Component<T>[] ccs, java.lang.Class<T> etype)
          Create a Component object that creates an array as instance.
static
<T> Component<T>
autodetect(java.lang.Class<T> type, java.lang.Object[] alternative_keys)
          Create a Component object that delegates to another component in the current container.
static Component autowired(Component c)
          To create a Component that ignores all subsequent customizations to the parameters or properties.
static
<T> Component<T>
bean(java.lang.Class<T> type)
          Create a Component object that uses Java Bean convention to create instance.
static
<T> Component<T>
bean(java.lang.Class<T> type, java.util.Set props)
          Create a Component object that uses Java Bean convention to create instance.
static
<T> Component<T>
bean(java.lang.Class<T> type, java.lang.String[] props)
          Create a Component object that uses Java Bean convention to create instance.
static
<T> Component<T>
bean(Component<T> cc)
          Create a new Component object from a base Component object that calls Java Bean setters after the base Component creates the instance.
static
<T> Component<T>
bean(Component<T> cc, java.util.Set props)
          Create a new Component object from a base Component object that calls Java Bean setters after the base Component creates the instance.
static
<T> Component<T>
bean(Component<T> cc, java.lang.String[] props)
          Create a new Component object from a base Component object that calls Java Bean setters after the base Component creates the instance.
static Component bindArgument(Component cc, int k, ParameterBinder binder)
          Customize one argument of a component with a ParameterBinder object.
static Component bindArguments(Component cc, ParameterBinder binder)
          Customize the arguments of a component with a ParameterBinder object.
static Dependency bindArguments(Dependency dependency, ParameterBinder binder)
          Customize a Dependency object with a ParameterBinder object.
static Component bindField(Component cc, java.lang.reflect.Field fld)
          Creates a Component that will read a certain field from the instance created by another Component.
static Component bindField(Component cc, java.lang.String name, boolean suppress_security)
          Creates a Component that will read a certain field from the instance created by another Component.
static Component bindGetter(Component cc, java.lang.String name)
          Create a Component that will return a bean property of the instance created by another component.
static Component bindGetter(Component cc, java.lang.String name, int ind)
          Create a Component that will get an indexed property of the Java Bean instance created by another component.
static Component bindMethod(Component cc, java.lang.reflect.Method mtd)
          Creates a Component that will call a certain method against the instance created by another Component.
static Component bindMethod(Component cc, java.lang.String name, boolean suppress_security)
          Creates a Component that will call a certain method against the instance created by another Component.
static Component bindMethod(Component cc, java.lang.String name, java.lang.Class[] param_types, boolean suppress_security)
          Creates a Component that will call a certain method against the instance created by another Component.
static Component bindMethod(Component cc, java.lang.String name, int param_count, boolean suppress_security)
          Creates a Component that will call a certain method against the instance created by another Component.
static Component bindProperties(Component cc, PropertyBinder binder)
          Customize the properties of a component with a PropertyBinder object.
static Dependency bindProperties(Dependency dependency, PropertyBinder binder)
          Customize a Dependency object with a PropertyBinder object.
static Component bindProperty(Component cc, java.lang.Object k, PropertyBinder binder)
          Customize the properties of a component with a PropertyBinder object.
static
<T> Component<T>
bindSetter(Component<T> cc, java.lang.String name, int ind)
          Create a Component that will set an indexed property of the Java Bean instance created by another component.
static Component bindSetter(Component cc, java.lang.String name)
          Create a Component that will set a bean property of the instance created by another component.
static
<T> Component<T>
cast(Component<?> cc, java.lang.Class<T> type)
          Customizes a Component object with a new component type.
static
<T> Component<T>
ctor(java.lang.Class<T> c)
          Create a Component object that uses the constructor of a class to create instance of that class.
static
<T> Component<T>
ctor(java.lang.Class<T> c, java.lang.Class[] param_types)
          Create a Component that uses one constructor of a class to create instance of that class.
static
<T> Component<Factory<T>>
factory(Creator<T> cc, java.lang.String toString)
          Create a Component that instantiates the Factory interface.
static
<F> Component<F>
factory(Creator cc, java.lang.Class<F> factory_class, java.lang.ClassLoader loader, java.lang.String toString)
          Create a Component that instantiates a factory interface.
static
<F> Component<F>
factory(Creator cc, java.lang.Class<F> factory_class, java.lang.String toString)
          Create a Component that instantiates a factory interface.
static Component field(java.lang.Class type, java.lang.Object obj, java.lang.String name)
          Create a Component object that reads a field from a given object to create component instance.
static Component field(java.lang.Object obj, java.lang.String name)
          Create a Component object that reads a field from a given object to create component instance.
static Component fromArguments(Component cc, java.lang.Object[] keys)
          Redirects resolution of properties to arguments.
static
<T> Component<T>
fromLazy(LazyComponent<T> lcc, java.lang.Object key)
          Adapt a LazyComponent object to Component.
static Component fromProperties(Component cc, java.lang.Object[] keys)
          Redirects resolution of arguments to properties.
static
<T> Component<T>
fun(Function<T> fun)
          Create a Component object that uses a Function to create instance.
static Component get(Component c, java.lang.Object key)
          To create a Component object that calls method "get" against the java.util.Map object instantiated by another Component.
static Component getter(java.lang.Class type, java.lang.Object obj, java.lang.String prop)
          Create a Component that calls a property getter of an object.
static Component getter(java.lang.Object obj, java.lang.String prop)
          Create a Component that calls a property getter of an object.
static
<T> Component<T>
guard(Component<T> cc)
          Decorate a Component object so that the new Component object guards against infinite dependency loop.
static
<K,T> Component<java.util.LinkedHashMap<K,T>>
hashmap(K[] keys, Creator<T>[] creators)
          Create a Component object that creates a java.util.LinkedHashMap object.
static
<T> Component<java.util.HashSet<T>>
hashset(Creator<T>... ccs)
          Create a Component object that creates java.util.HashSet.
static
<T> Component<T>
incomplete(Component<T> cc)
          By default, all components depended by a component will be verified when the component is verified.
static Component indexed_getter(java.lang.Class type, java.lang.Object obj, java.lang.String prop, int ind)
          Create a Component that calls an indexed property getter of an object.
static Component indexed_getter(java.lang.Object obj, java.lang.String prop, int ind)
          Create a Component that calls an indexed property getter of an object.
static
<T> Component<T>
indexed_setter(java.lang.Class type, T obj, java.lang.String prop, int ind)
          Create a Component that calls an indexed property setter against an object.
static
<T> Component<T>
indexed_setter(T obj, java.lang.String prop, int ind)
          Create a Component that calls an indexed property setter against an object.
static ComponentBinder invokingGetter(java.lang.Class type, java.lang.String name)
          To create a ComponentBinder object that invokes a Java Bean getter against the bound object.
static ComponentBinder invokingMethod(java.lang.Class type, java.lang.String name, boolean suppress_security)
          Create a ComponentBinder object that invokes a method against the bound object.
static ComponentBinder invokingMethod(java.lang.Class type, java.lang.String name, java.lang.Class[] param_types, boolean suppress_security)
          To create a ComponentBinder object that invokes a method against the bound object.
static ComponentBinder invokingMethod(java.lang.Class type, java.lang.String name, int param_count, boolean suppress_security)
          Create a ComponentBinder object that invokes a method against the bound object.
static
<T> ComponentBinder<T,T>
invokingSetter(java.lang.Class<T> type, java.lang.String name)
          Create a ComponentBinder object that will invoke a Java Bean setter against the bound object.
static
<T> Component<T>
label(Component<T> cc, java.lang.Object lbl)
          Label the frame for a Component so that whenever a YanException is thrown, the provided label will be populated in the resolution trace.
static
<T> Component<java.util.ArrayList<T>>
list(Creator<T>... ccs)
          Create a Component object that creates java.util.ArrayList.
static
<T,C extends Creator<T>>
Component<java.util.ArrayList<T>>
list(java.util.List<C> ccs)
          Create a Component object that creates java.util.ArrayList.
static
<T> Component<T>
makeBean(Component<T> cc, PropertiesInjector injector)
          Create a Bean component that calls a PropertiesInjector to inject bean properties to the bean instance.
static
<T> Component<T>
makeBean(java.lang.String name, Component<T> cc, PropertiesInjector injector)
          Create a Bean component that calls a PropertiesInjector to inject bean properties to the bean instance.
static Component method(java.lang.Class type, java.lang.Object obj, java.lang.String name)
          Create a Component object that invokes a method against a given object to create component instance.
static Component method(java.lang.Class type, java.lang.Object obj, java.lang.String name, java.lang.Class[] param_types)
          Create a Component object that invokes a method against a given object to create component instance.
static Component method(java.lang.Object obj, java.lang.String name)
          Create a Component object that invokes a method against a given object to create component instance.
static Component method(java.lang.Object obj, java.lang.String name, java.lang.Class[] param_types)
          Create a Component object that invokes a method against a given object to create component instance.
static
<T> Component<T>
mutate(Component<T> cc, Mutation<T> m)
          Customizes a Component object so that upon creation, the new Component object mutates the result component instance before it is returned.
static
<T> Component<T>
optionalParameter(Component<T> cc, int k)
          Creates a new Component object that makes a parameter optional.
static
<T> Component<T>
optionalParameters(Component<T> cc)
          Make sure the parameters of a component are optional.
static
<T> Component<T>
optionalProperties(Component<T> cc)
          Make sure the properties of a Java bean component are optional.
static
<T> Component<T>
optionalProperty(Component<T> cc, java.lang.Object k)
          Creates a new Component object that makes a property identified by a key optional.
static Component proxy(Component cc)
          Customizes a Component object so that the new Component object will return a dynamic proxy and hide the real component instance.
static
<I> Component<I>
proxy(Component<?> cc, java.lang.Class<I> itf)
          Customizes a Component object so that the new Component object will return a dynamic proxy and hide the real component instance.
static Component proxy(Component cc, java.lang.Class[] itfs)
          Customizes a Component object so that the new Component object will return a dynamic proxy and hide the real component instance.
static Component proxy(Component cc, java.lang.Class[] itfs, java.lang.ClassLoader loader)
          Customizes a Component object so that the new Component object will return a dynamic proxy and hide the real component instance.
static ComponentBinder readingField(java.lang.Class type, java.lang.String name, boolean suppress_security)
          Create a ComponentBinder object that reads a field value from the bound object.
static
<T> Component<T>
repeat(Creator<T> cc, int times)
          Create a Component that repeatedly call another Component for certain amount of times.
static Component returnState(Stateful st)
          Create a Component object that returns the state of a Stateful object as its component instance.
static Component returnType(Typeful t)
          Create a Component object that returns the type of a Typeful object as its component instance.
static Component returnVerification(Verifiable veri)
          Create a Component object that verifies the Verifiable object and returns the result type as return value.
static Component seal(Component cc)
          Create a sealed component.
static
<T> Component<T>
setter(java.lang.Class type, T obj, java.lang.String prop)
          Create a Component that calls a property setter against an object.
static
<T> Component<T>
setter(T obj, java.lang.String prop)
          Create a Component that calls a property setter against an object.
static
<T> Component<T>
singleton(Component<T> cc)
          Create a new Component object that utilizes singleton pattern.
static
<T> Component<T>
singleton(Component<T> cc, Pool<T> scope)
          Create a new Component object that utilizes singleton pattern within the scope of the provided Pool object.
static Component static_field(java.lang.Class c, java.lang.String name)
          Create a Component object that reads a static field to create instance.
static Component static_method(java.lang.Class c, java.lang.String name)
          Create a Component object that invokes a static method to create instance.
static Component static_method(java.lang.Class c, java.lang.String name, java.lang.Class[] param_types)
          Create a Component object that invokes a static method to create instance.
static
<T> Component<T[]>
storeArray(Component<T[]> component_returning_array, Creator<T>... creators)
           
static
<T,L extends java.util.List<T>>
Component<L>
storeList(Component<L> component_returning_list, Creator<T>... creators)
          Create a Component object that sequentially execute an array of components and collect the result into a java.util.List object.
static
<K,T,M extends java.util.Map<K,T>>
Component<M>
storeMap(Component<M> component_return_map, K[] keys, Creator<T>[] vals)
          Create a Component that sequentially execute an array of Component object, and collect the results in a java.util.Map object.
static
<T,S extends java.util.Set<T>>
Component<S>
storeSet(Component<S> component_returning_set, Creator<T>... creators)
          Create a Component object that sequentially execute an array of components and collect the result into a java.util.Set object.
static Component subscript(Component c, int ind)
          To create a Component that returns an element of the array/list instance returned from another Component object.
static
<Super,T extends Super>
Component<Super>
subsume(Component<T> cc, java.lang.Class<Super> type)
          Customizes a Component object with a new component type.
static
<T> Component<T>
synchronizedComponent(Component<T> cc)
          Create a Component that the "create()" method is put in a synchronized block to ensure thread safety.
static Component<ComponentMap> thisContainer()
          Create a Component object that returns the container object.
static
<T> Component<java.util.List<T>>
useAll(java.lang.Class<T> type)
          Create a Component object that creates a java.util.List.
static
<T> Component<java.util.ArrayList<T>>
useAll(ComponentMap cmap, java.lang.Class<T> type)
          Create a Component object that creates a java.util.List.
static
<T> Component<T>
useArgument(Signature src, int pos, java.lang.Class<T> type)
          Create a component that uses a particular argument value of the parent component as its instance.
static Part useContainer(ComponentMap cmap)
          Create a Part object that redirects the resolution of a typed parameter/property to another container.
static Component useDefault()
          Creates a Component that throws DefaultingException.
static Component useKey(ComponentMap cmap, java.lang.Object key)
          Create a Component object that delegates to another component identified by a key in a container.
static Component useKey(java.lang.Object key)
          Create a Component object that delegates to another component identified by a key in the current container.
static
<T> Component<T>
useProperty(java.lang.Class component_type, java.lang.Object key, java.lang.Class<T> type)
          Create a component that uses a particular property value of the parent component as its instance.
static Component useState(ComponentMap cmap, Predicate pred)
          Create a Component object that creates a java.util.List.
static Component useState(Predicate pred)
          Create a Component object that creates a java.util.List.
static
<T> Component<T>
useType(java.lang.Class<T> type)
          Create a Component object that delegates to another component in the current container.
static
<T> Component<T>
useType(ComponentMap cmap, java.lang.Class<T> type)
          Create a Component object that delegates to another component in a container.
static Component<java.lang.Boolean> value(boolean val)
          Create a Component object that simply return a value upon instance creation.
static Component<java.lang.Byte> value(byte val)
          Create a Component object that simply return a value upon instance creation.
static Component<java.lang.Character> value(char val)
          Create a Component object that simply return a value upon instance creation.
static Component<java.lang.Double> value(double val)
          Create a Component object that simply return a value upon instance creation.
static Component<java.lang.Float> value(float val)
          Create a Component object that simply return a value upon instance creation.
static Component<java.lang.Integer> value(int val)
          Create a Component object that simply return a value upon instance creation.
static Component<java.lang.Long> value(long val)
          Create a Component object that simply return a value upon instance creation.
static Component<java.lang.Short> value(short val)
          Create a Component object that simply return a value upon instance creation.
static
<T> Component<T>
value(T val)
          Create a Component object that simply return a value upon instance creation.
static
<T> Component<T>
withArgument(Component<T> cc, int k, Part part)
          Customizes the creation of one parameter of a Component object with a Part object.
static Component withArgument(Component cc, int k, Creator factory)
          Customizes the creation of one parameter of a Component object using a Creator object.
static Component withArguments(Component cc, Creator[] creators)
          Customizes a Component's parameters with an array of Creator objects.
static Component withArguments(Component cc, Part part)
          Customizes a Component with a Part object to create all its parameters.
static
<T> Component<T>
withDefaultArgument(Component<T> cc, int k, Creator v)
          Create a Component object that will use an alternative Creator object when a certain parameter cannot be resolved or is passed in as default.
static
<T> Component<T>
withDefaultProperty(Component<T> cc, java.lang.Object k, Creator v)
          Create a Component object that will use an alternative Creator object when a certain property cannot be resolved or is passed in as default.
static Component withProperties(Component cc, java.util.Map props)
          Customizes a Component's properties with provided Creator objects stored in a java.util.Map object.
static Component withProperties(Component cc, Part part)
          Customizes a Component object with a Part object to create all its property values.
static Component withProperties(Component cc, java.lang.String[] names, Creator[] creators)
          Customizes a Component's properties with the provided Creator objects.
static
<T> Component<T>
withProperty(Component<T> cc, java.lang.Object k, Creator factory)
          Customizes the creation of one property value of a Component object with a Creator object.
static
<T> Component<T>
withProperty(Component<T> cc, java.lang.Object k, Part part)
          Customizes the creation of one property value of a Component object with a Part object.
static
<T> Component<T>
withState(Component<T> cc, java.lang.Object obj)
          Customizes a Component object with the specified user state.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Components

public Components()
Method Detail

adapt

public static <T> Component<T> adapt(Creator<T> c)
To adapt a Creator object to a Component object. if the object is already a Component, itself is returned.

Parameters:
c - the creator object.
Returns:
the Component object.

fun

public static <T> Component<T> fun(Function<T> fun)
Create a Component object that uses a Function to create instance.

Parameters:
fun - the Function object.
Returns:
the Component object.

ctor

public static <T> Component<T> ctor(java.lang.Class<T> c)
                         throws java.lang.IllegalArgumentException
Create a Component object that uses the constructor of a class to create instance of that class. This class should have one and only one public constructor.
Array type is given a special constructor so that the constructor of array type T has one parameter of type int and calls new T[size] when invoked.

Parameters:
c - the class.
Returns:
the Component object.
Throws:
java.lang.IllegalArgumentException - if the class is not public or has no public constructor or has more than one public constructor.

ctor

public static <T> Component<T> ctor(java.lang.Class<T> c,
                                    java.lang.Class[] param_types)
                         throws java.lang.IllegalArgumentException
Create a Component that uses one constructor of a class to create instance of that class. The constructor to invoke is determined by the parameter types specified.
Array type is given a special constructor so that the constructor of array type T has one parameter of type int and calls new T[size] when invoked.

Parameters:
c - the class.
param_types - the parameter types of the constructor to use. null indicates the default constructor.
Returns:
the Component object.
Throws:
java.lang.IllegalArgumentException - if the type is not public or the public constructor cannot be found.

static_method

public static Component static_method(java.lang.Class c,
                                      java.lang.String name)
                               throws java.lang.IllegalArgumentException
Create a Component object that invokes a static method to create instance. This class should have one and only one public static method of this name.

Parameters:
c - the class where the static method belongs.
name - the static method name.
Returns:
the Component object.
Throws:
java.lang.IllegalArgumentException - thrown if any of the following conditions is true:
1. this method is not public.
2. this method is not static.
3. more than one public static method with the specified name.
4. no public static method with the specified name.

static_method

public static Component static_method(java.lang.Class c,
                                      java.lang.String name,
                                      java.lang.Class[] param_types)
Create a Component object that invokes a static method to create instance. The static method to invoke is determined by the method name and the parameter types.

Parameters:
c - the class where the static method belongs.
name - the static method name.
param_types - the parameter types. null indicates a parameter-less method.
Returns:
the Component object.
Throws:
java.lang.IllegalArgumentException - thrown if any of the following conditions is true:
1. this method is not public.
2. this method is not static.
3. no public static method with the specified name and the parameter types.

method

public static Component method(java.lang.Object obj,
                               java.lang.String name)
Create a Component object that invokes a method against a given object to create component instance. The class of the object should have one and only one public method of this name.

Parameters:
obj - the object to run the method against. It cannot be null.
name - the method name.
Returns:
the Component object.
Throws:
java.lang.IllegalArgumentException - thrown if any of the following conditions is true:
1. this method is not public.
2. more than one public method with the specified name.
3. no public method with the specified name.

method

public static Component method(java.lang.Class type,
                               java.lang.Object obj,
                               java.lang.String name)
Create a Component object that invokes a method against a given object to create component instance. The class of the object should have one and only one public static method of this name.

Parameters:
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 can be null if the method is static.
name - the method name.
Returns:
the Component object.
Throws:
java.lang.IllegalArgumentException - thrown if any of the following conditions is true:
1. this method is not public.
2. more than one public method with the specified name.
3. no public method with the specified name.

method

public static Component method(java.lang.Object obj,
                               java.lang.String name,
                               java.lang.Class[] param_types)
Create a Component object that invokes a method against a given object to create component instance. The method to invoke is determined by the method name and the parameter types.

Parameters:
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.
Returns:
the Component object.
Throws:
java.lang.IllegalArgumentException - thrown if any of the following conditions is true:
1. this method is not public.
2. no public method with the specified name and the parameter types.

method

public static Component method(java.lang.Class type,
                               java.lang.Object obj,
                               java.lang.String name,
                               java.lang.Class[] param_types)
Create a Component object that invokes a method against a given object to create component instance. The method to invoke is determined by the method name and the parameter types.

Parameters:
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 can be null if the method is static.
name - the method name.
param_types - the parameter types. null indicates a parameter-less method.
Returns:
the Component object.
Throws:
java.lang.IllegalArgumentException - thrown if any of the following conditions is true:
1. this method is not public.
2. no public method with the specified name and the parameter types.

static_field

public static Component static_field(java.lang.Class c,
                                     java.lang.String name)
                              throws java.lang.IllegalArgumentException
Create a Component object that reads a static field to create instance.

Parameters:
c - the class where the static instance belongs.
name - the static instance name.
Returns:
the Component object.
Throws:
java.lang.IllegalArgumentException - thrown if any of the following conditions is true:
1. field not found.
2. field is not static.

field

public static Component field(java.lang.Class type,
                              java.lang.Object obj,
                              java.lang.String name)
Create a Component object that reads a field from a given object to create component instance.

Parameters:
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. It can be null if the field is static.
name - the field name.
Returns:
the Component object.
Throws:
java.lang.IllegalArgumentException - thrown if any of the following conditions is true:
1. field is not found.

field

public static Component field(java.lang.Object obj,
                              java.lang.String name)
Create a Component object that reads a field from a given object to create component instance.

Parameters:
obj - the object to read the field from. It cannot be null.
name - the field name.
Returns:
the Component object.
Throws:
java.lang.IllegalArgumentException - thrown if any of the following conditions is true:
1. field not found.

getter

public static Component getter(java.lang.Class type,
                               java.lang.Object obj,
                               java.lang.String prop)
                        throws java.beans.IntrospectionException,
                               NoSuchPropertyException,
                               NonReadablePropertyException
Create a Component that calls a property getter of an object.

Parameters:
type - the type to introspect.
obj - the object to run the getter against.
prop - the property name.
Returns:
the Component object.
Throws:
java.beans.IntrospectionException - if introspection fails.
NoSuchPropertyException - if the property does not exist.
NonReadablePropertyException - if the property is not rreadable.

setter

public static <T> Component<T> setter(java.lang.Class type,
                                      T obj,
                                      java.lang.String prop)
                           throws java.beans.IntrospectionException,
                                  NoSuchPropertyException,
                                  NonWritablePropertyException
Create a Component that calls a property setter against an object.

Parameters:
type - the type to introspect.
obj - the object.
prop - the property name.
Returns:
the Component object.
Throws:
java.beans.IntrospectionException - if introspection fails.
NoSuchPropertyException - if the the property cannot be found.
NonWritablePropertyException - if the property is not writable.

indexed_getter

public static Component indexed_getter(java.lang.Class type,
                                       java.lang.Object obj,
                                       java.lang.String prop,
                                       int ind)
                                throws java.beans.IntrospectionException,
                                       NoSuchPropertyException,
                                       NonReadablePropertyException
Create a Component that calls an indexed property getter of an object.

Parameters:
type - the type to introspect.
obj - the object to run the getter against.
prop - the property name.
ind - the index.
Returns:
the Component object.
Throws:
java.beans.IntrospectionException - if introspection fails.
NoSuchPropertyException - if the property does not exist.
NonReadablePropertyException - if the property is not rreadable or if the property is not indexed.

indexed_setter

public static <T> Component<T> indexed_setter(java.lang.Class type,
                                              T obj,
                                              java.lang.String prop,
                                              int ind)
                                   throws java.beans.IntrospectionException,
                                          NoSuchPropertyException,
                                          NonWritablePropertyException
Create a Component that calls an indexed property setter against an object.

Parameters:
type - the type to introspect.
obj - the object.
prop - the property name.
ind - the index.
Returns:
the Component object.
Throws:
java.beans.IntrospectionException - if introspection fails.
NoSuchPropertyException - if the the property cannot be found.
NonWritablePropertyException - if the property is not writable or not indexed.

getter

public static Component getter(java.lang.Object obj,
                               java.lang.String prop)
                        throws java.beans.IntrospectionException,
                               NoSuchPropertyException,
                               NonReadablePropertyException
Create a Component that calls a property getter of an object.

Parameters:
obj - the object to run the getter against.
prop - the property name.
Returns:
the Component object.
Throws:
java.beans.IntrospectionException - if introspection fails.
NoSuchPropertyException - if the property does not exist.
NonReadablePropertyException - if the property is not rreadable.

setter

public static <T> Component<T> setter(T obj,
                                      java.lang.String prop)
                           throws java.beans.IntrospectionException,
                                  NoSuchPropertyException,
                                  NonWritablePropertyException
Create a Component that calls a property setter against an object.

Parameters:
obj - the object to run the setter against.
prop - the property name.
Returns:
the Component object.
Throws:
java.beans.IntrospectionException - if introspection fails.
NoSuchPropertyException - if the the property cannot be found.
NonWritablePropertyException - if the property is not writable.

indexed_getter

public static Component indexed_getter(java.lang.Object obj,
                                       java.lang.String prop,
                                       int ind)
                                throws java.beans.IntrospectionException,
                                       NoSuchPropertyException,
                                       NonReadablePropertyException
Create a Component that calls an indexed property getter of an object.

Parameters:
obj - the object to run the getter against.
prop - the property name.
ind - the index.
Returns:
the Component object.
Throws:
java.beans.IntrospectionException - if introspection fails.
NoSuchPropertyException - if the property does not exist.
NonReadablePropertyException - if the property is not rreadable or if the property is not indexed.

indexed_setter

public static <T> Component<T> indexed_setter(T obj,
                                              java.lang.String prop,
                                              int ind)
                                   throws java.beans.IntrospectionException,
                                          NoSuchPropertyException,
                                          NonWritablePropertyException
Create a Component that calls an indexed property setter against an object.

Parameters:
obj - the object to run the setter against.
prop - the property name.
ind - the index.
Returns:
the Component object.
Throws:
java.beans.IntrospectionException - if introspection fails.
NoSuchPropertyException - if the the property cannot be found.
NonWritablePropertyException - if the property is not writable or not indexed.

value

public static <T> Component<T> value(T val)
Create a Component object that simply return a value upon instance creation. The type of the value is used as the type of the component. null is permitted as a value too. void.class is used as the type of the component if the value is null.

Parameters:
val - the value.
Returns:
the Component object.

value

public static Component<java.lang.Double> value(double val)
Create a Component object that simply return a value upon instance creation. double.class is used as the component type.

Parameters:
val - the value.
Returns:
the Component object.

value

public static Component<java.lang.Float> value(float val)
Create a Component object that simply return a value upon instance creation. float.class is used as the component type.

Parameters:
val - the value.
Returns:
the Component object.

value

public static Component<java.lang.Long> value(long val)
Create a Component object that simply return a value upon instance creation. long.class is used as the component type.

Parameters:
val - the value.
Returns:
the Component object.

value

public static Component<java.lang.Integer> value(int val)
Create a Component object that simply return a value upon instance creation. int.class is used as the component type.

Parameters:
val - the value.
Returns:
the Component object.

value

public static Component<java.lang.Short> value(short val)
Create a Component object that simply return a value upon instance creation. short.class is used as the component type.

Parameters:
val - the value.
Returns:
the Component object.

value

public static Component<java.lang.Byte> value(byte val)
Create a Component object that simply return a value upon instance creation. byte.class is used as the component type.

Parameters:
val - the value.
Returns:
the Component object.

value

public static Component<java.lang.Character> value(char val)
Create a Component object that simply return a value upon instance creation. char.class is used as the component type.

Parameters:
val - the value.
Returns:
the Component object.

value

public static Component<java.lang.Boolean> value(boolean val)
Create a Component object that simply return a value upon instance creation. boolean.class is used as the component type.

Parameters:
val - the value.
Returns:
the Component object.

<