|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--fipaos.util.DynamicClass
This class provides dynamic access to methods of classes which may not be available at compile time & run time.
Inner Class Summary | |
static class |
DynamicClass.CollectionHint
Hint for a collection type - details Classes than it can contain |
static class |
DynamicClass.ConstrainedSelectionHint
Hint for a property that should take only a constrained set of values |
static class |
DynamicClass.ImmutableHint
Hint that a CLASS is immutable (i.e. |
static class |
DynamicClass.PossibleSelectionHint
Hint for a property that COULD take a predefined set of values, or something else of the specified type |
static class |
DynamicClass.Property
Class to represent a property type |
static class |
DynamicClass.PropertyHint
Umbrella class PropertyHint that all property-hint types extend |
Field Summary | |
static java.lang.String |
GET_HINTS_METHOD
Indicates name of method to invoke in order to get hints for a particular property |
Constructor Summary | |
DynamicClass(java.lang.Object obj)
Creates a DynamicClass to wrap the given Object |
|
DynamicClass(java.lang.String class_name)
Creates an instance of the given class, using the default constructor. |
|
DynamicClass(java.lang.String class_name,
java.lang.Class[] params,
java.lang.Object[] args)
Creates an instance of the given class, using the constructor with the given arguments. |
Method Summary | |
static java.lang.Object |
createInstance(java.lang.String class_name)
Instantiate an instance of a particular class |
static java.lang.Object |
createInstance(java.lang.String class_name,
java.lang.Class[] param_types,
java.lang.Object[] params)
Instatiates a class, using a constructor with the given parameters |
java.lang.Object |
duplicate()
Attempt to duplicate the object this DynamicClass wrapps using the following mechanisms in the given order: Object.clone() Serialization |
DynamicClass.PropertyHint |
getHint(java.lang.String property)
Get the hint (if available) for the given property - returns null if no hint available |
java.lang.Object |
getObject()
|
java.util.List |
getProperties()
Gets the properties for this object (i.e. |
java.lang.Object |
invoke(java.lang.String method)
Invokes a method on the wrapper object without any arguments |
java.lang.Object |
invoke(java.lang.String method,
java.lang.Class[] params,
java.lang.Object[] args)
Invokes a method on the wrapper object with the given arguments |
static java.lang.Object |
invokeStatic(java.lang.String class_name,
java.lang.String method)
Invokes a method on the given object with no arguments |
static java.lang.Object |
invokeStatic(java.lang.String class_name,
java.lang.String method,
java.lang.Class[] params,
java.lang.Object[] args)
Invokes a method on the given object with the given arguments |
static void |
main(java.lang.String[] args)
|
java.lang.String |
toString()
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
public static final java.lang.String GET_HINTS_METHOD
Constructor Detail |
public DynamicClass(java.lang.String class_name, java.lang.Class[] params, java.lang.Object[] args) throws java.lang.ClassNotFoundException, java.lang.NoSuchMethodException, java.lang.InstantiationException, DynamicClassException
class_name
- Name of the class to wrapparams
- Argument signature for the constructor to useargs
- Array containing parameters for constructor of class to wrappublic DynamicClass(java.lang.String class_name) throws java.lang.ClassNotFoundException, java.lang.NoSuchMethodException, java.lang.InstantiationException, DynamicClassException
class_name
- Name of the class to wrapargs
- Array containing parameters for constructor of class to wrappublic DynamicClass(java.lang.Object obj)
obj
- Wrap the given objectMethod Detail |
public java.lang.Object invoke(java.lang.String method, java.lang.Class[] params, java.lang.Object[] args) throws DynamicClassException, java.lang.NoSuchMethodException
method
- The name of the method to invokeparams
- Classes of arguments making up signature of method to invokeargs
- An array of object to be used as arguments to the
method being invoked (primitive types should be wrapped
in appropriate Java classes (e.g. double => Double ).public java.lang.Object invoke(java.lang.String method) throws DynamicClassException, java.lang.NoSuchMethodException
method
- The name of the method to invokepublic static java.lang.Object invokeStatic(java.lang.String class_name, java.lang.String method, java.lang.Class[] params, java.lang.Object[] args) throws DynamicClassException, java.lang.NoSuchMethodException, java.lang.ClassNotFoundException
method
- The name of the method to invokeargs
- An array of object to be used as arguments to the
method being invoked (primitive types should be wrapped
in appropriate Java classes (e.g. double => Double ).params
- The classes of the arguments of the method to invokepublic static java.lang.Object invokeStatic(java.lang.String class_name, java.lang.String method) throws DynamicClassException, java.lang.NoSuchMethodException, java.lang.ClassNotFoundException
method
- The name of the method to invokepublic java.lang.String toString()
toString
in class java.lang.Object
public java.lang.Object getObject()
public static java.lang.Object createInstance(java.lang.String class_name)
class_name
- Fully qualified name of the class to instantitatepublic static java.lang.Object createInstance(java.lang.String class_name, java.lang.Class[] param_types, java.lang.Object[] params)
class_name
- Name of the class to instantiateparam_types
- An array of the types of the parameters of the constructor to useparams
- The actual parameters to the constructorpublic java.lang.Object duplicate()
public java.util.List getProperties()
The List returned contains Property instances, or null if the Object is immutable
public DynamicClass.PropertyHint getHint(java.lang.String property)
public static void main(java.lang.String[] args) throws java.lang.Throwable
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |