|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.bbn.openmap.util.ComponentFactory
public class ComponentFactory
The OpenMap ComponentFactory is a class that can construct objects from class names, with the added capability of passing the new object a Properties object to initialize itself. The new object may also receive a property prefix to use to scope its properties from the Properties object. It is sensitive to the OpenMap paradigm of marker names in a list: That a list of objects can be defined as a space separated names (marker names) within a String. Those marker names can serve as a prefix for other properties within a Properties object, as well as the prefix for a '.class' property to define the class name for the new object.
Field Summary | |
---|---|
static java.lang.String |
ClassNameProperty
A property to use for the class name of new objects - "class". |
static java.lang.String |
DotClassNameProperty
The property to use for the class name of new objects - ".class". |
static java.util.logging.Logger |
logger
|
Constructor Summary | |
---|---|
protected |
ComponentFactory()
|
Method Summary | |
---|---|
protected java.lang.Object |
_create(java.lang.String className,
java.lang.Object[] constructorArgs,
java.lang.Class<?>[] argClasses,
java.lang.String prefix,
java.util.Properties properties)
Create a single object. |
protected java.util.Vector<?> |
_create(java.util.Vector<java.lang.String> markerNames,
java.lang.String prefix,
java.util.Properties properties,
ProgressSupport progressSupport,
boolean matchInOutVectorSize)
Given a Vector of marker name Strings, and a Properties object, look in the Properties object for the markerName.class property to get a class name to create each object. |
static java.lang.Object |
create(java.lang.String className)
Create a single object. |
static java.lang.Object |
create(java.lang.String className,
java.lang.Object[] constructorArgs)
Create a single object. |
static java.lang.Object |
create(java.lang.String className,
java.lang.Object[] constructorArgs,
java.lang.Class<?>[] argClasses)
Create a single object. |
static java.lang.Object |
create(java.lang.String className,
java.lang.Object[] constructorArgs,
java.lang.Class<?>[] argClasses,
java.lang.String prefix,
java.util.Properties properties)
Create a single object. |
static java.lang.Object |
create(java.lang.String className,
java.lang.Object[] constructorArgs,
java.lang.String prefix,
java.util.Properties properties)
Create a single object. |
static java.lang.Object |
create(java.lang.String className,
java.util.Properties properties)
Create a single object. |
static java.lang.Object |
create(java.lang.String className,
java.lang.String prefix,
java.util.Properties properties)
Create a single object. |
static java.util.Vector<?> |
create(java.util.Vector<java.lang.String> markerNames,
java.util.Properties properties)
Given a Vector of marker name Strings, and a Properties object, look in the Properties object for the markerName.class property to get a class name to create each object. |
static java.util.Vector<?> |
create(java.util.Vector<java.lang.String> markerNames,
java.util.Properties properties,
ProgressSupport progressSupport)
Given a Vector of marker name Strings, and a Properties object, look in the Properties object for the markerName.class property to get a class name to create each object. |
static java.util.Vector<?> |
create(java.util.Vector<java.lang.String> markerNames,
java.util.Properties properties,
ProgressSupport progressSupport,
boolean matchInOutVectorSize)
Given a Vector of marker name Strings, and a Properties object, look in the Properties object for the markerName.class property to get a class name to create each object. |
static java.util.Vector<?> |
create(java.util.Vector<java.lang.String> markerNames,
java.lang.String prefix,
java.util.Properties properties)
Given a Vector of marker name Strings, and a Properties object, look in the Properties object for the markerName.class property to get a class name to create each object. |
static java.util.Vector<?> |
create(java.util.Vector<java.lang.String> markerNames,
java.lang.String prefix,
java.util.Properties properties,
ProgressSupport progressSupport)
Given a Vector of marker name Strings, and a Properties object, look in the Properties object for the markerName.class property to get a class name to create each object. |
static java.util.Vector<?> |
create(java.util.Vector<java.lang.String> markerNames,
java.lang.String prefix,
java.util.Properties properties,
ProgressSupport progressSupport,
boolean matchInOutVectorSize)
Given a Vector of marker name Strings, and a Properties object, look in the Properties object for the markerName.class property to get a class name to create each object. |
protected java.lang.Object |
createWithSubclassConstructorArgs(java.lang.Class<?> newObjClass,
java.lang.Class<?>[] argClasses,
java.lang.Object[] constructorArgs)
Method to create Object with arguments. |
protected static ComponentFactory |
getInstance()
Method call to retrieve the singleton instance of the ComponentFactory. |
protected static void |
setInstance(ComponentFactory cf)
Set the singleton instance of the ComponentFactory. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static java.util.logging.Logger logger
public static final java.lang.String DotClassNameProperty
public static final java.lang.String ClassNameProperty
Constructor Detail |
---|
protected ComponentFactory()
Method Detail |
---|
protected static ComponentFactory getInstance()
protected static void setInstance(ComponentFactory cf)
cf
- public static java.util.Vector<?> create(java.util.Vector<java.lang.String> markerNames, java.util.Properties properties)
markerNames
- String of space separated marker names.properties
- Properties object containing the details.
public static java.util.Vector<?> create(java.util.Vector<java.lang.String> markerNames, java.lang.String prefix, java.util.Properties properties)
markerNames
- String of space separated marker names.prefix
- The prefix that should be prepended to the marker names.properties
- Properties object containing the details.
public static java.util.Vector<?> create(java.util.Vector<java.lang.String> markerNames, java.lang.String prefix, java.util.Properties properties, ProgressSupport progressSupport)
markerNames
- String of space separated marker names.prefix
- The prefix that should be prepended to the marker names.properties
- Properties object containing the details.progressSupport
- ProgressSupport object to provide progress updates
to. It's OK if this is null to not have progress events sent.
public static java.util.Vector<?> create(java.util.Vector<java.lang.String> markerNames, java.util.Properties properties, ProgressSupport progressSupport)
markerNames
- String of space separated marker names.properties
- Properties object containing the details.progressSupport
- ProgressSupport object to provide progress updates
to. It's OK if this is null to not have progress events sent.
public static java.util.Vector<?> create(java.util.Vector<java.lang.String> markerNames, java.util.Properties properties, ProgressSupport progressSupport, boolean matchInOutVectorSize)
markerNames
- String of space separated marker names.properties
- Properties object containing the details.progressSupport
- ProgressSupport object to provide progress updates
to. It's OK if this is null to not have progress events sent.matchInOutVectorSize
- if true, then if there is any trouble
creating an object, it's marker name will be placed in the
returned vector instead of a component. If false, only valid
objects will be returned in the vector.
public static java.util.Vector<?> create(java.util.Vector<java.lang.String> markerNames, java.lang.String prefix, java.util.Properties properties, ProgressSupport progressSupport, boolean matchInOutVectorSize)
markerNames
- String of space separated marker names.prefix
- The prefix that should be prepended to the marker names.properties
- Properties object containing the details.progressSupport
- ProgressSupport object to provide progress updates
to. It's OK if this is null to not have progress events sent.matchInOutVectorSize
- if true, then if there is any trouble
creating an object, it's marker name will be placed in the
returned vector instead of a component. If false, only valid
objects will be returned in the vector.
protected java.util.Vector<?> _create(java.util.Vector<java.lang.String> markerNames, java.lang.String prefix, java.util.Properties properties, ProgressSupport progressSupport, boolean matchInOutVectorSize)
markerNames
- String of space separated marker names.prefix
- The prefix that should be prepended to the marker names.properties
- Properties object containing the details.progressSupport
- ProgressSupport object to provide progress updates
to. It's OK if this is null to not have progress events sent.matchInOutVectorSize
- if true, then if there is any trouble
creating an object, it's marker name will be placed in the
returned vector instead of a component. If false, only valid
objects will be returned in the vector.
public static java.lang.Object create(java.lang.String className)
className
- Class name to instantiate, empty constructor.
public static java.lang.Object create(java.lang.String className, java.util.Properties properties)
className
- Class name to instantiate.properties
- Properties to use to initialize the object, if the
object is a PropertyConsumer.
public static java.lang.Object create(java.lang.String className, java.lang.String prefix, java.util.Properties properties)
className
- Class name to instantiate.prefix
- Properties prefix to use by the object to scope its
properties.properties
- Properties to use to initialize the object, if the
object is a PropertyConsumer.
public static java.lang.Object create(java.lang.String className, java.lang.Object[] constructorArgs)
className
- Class name to instantiate.constructorArgs
- an Object array of arguments to use in the
constructor of the component.
public static java.lang.Object create(java.lang.String className, java.lang.Object[] constructorArgs, java.lang.Class<?>[] argClasses)
className
- Class name to instantiate.constructorArgs
- an Object array of arguments to use in the
constructor of the component.argClasses
- an array of classes to use to scope which constructor
to use. If null, then an array will be built from the
constructorArgs.
public static java.lang.Object create(java.lang.String className, java.lang.Object[] constructorArgs, java.lang.String prefix, java.util.Properties properties)
className
- Class name to instantiate.constructorArgs
- an Object array of arguments to use in the
constructor of the component.prefix
- Properties prefix to use by the object to scope its
properties.properties
- Properties to use to initialize the object, if the
object is a PropertyConsumer.
public static java.lang.Object create(java.lang.String className, java.lang.Object[] constructorArgs, java.lang.Class<?>[] argClasses, java.lang.String prefix, java.util.Properties properties)
className
- Class name to instantiate.constructorArgs
- an Object array of arguments to use in the
constructor of the component.argClasses
- an array of classes to use to scope which constructor
to use. If null, then an array will be built from the
constructorArgs.prefix
- Properties prefix to use by the object to scope its
properties.properties
- Properties to use to initialize the object, if the
object is a PropertyConsumer.
protected java.lang.Object _create(java.lang.String className, java.lang.Object[] constructorArgs, java.lang.Class<?>[] argClasses, java.lang.String prefix, java.util.Properties properties)
className
- Class name to instantiate.constructorArgs
- an Object array of arguments to use in the
constructor of the component.argClasses
- an array of classes to use to scope which constructor
to use. If null, then an array will be built from the
constructorArgs.prefix
- Properties prefix to use by the object to scope its
properties.properties
- Properties to use to initialize the object, if the
object is a PropertyConsumer.
protected java.lang.Object createWithSubclassConstructorArgs(java.lang.Class<?> newObjClass, java.lang.Class<?>[] argClasses, java.lang.Object[] constructorArgs) throws java.lang.NoSuchMethodException, java.lang.InstantiationException, java.lang.IllegalAccessException, java.lang.IllegalArgumentException, java.lang.reflect.InvocationTargetException
newObjClass
- the Class to be created.argClasses
- an array of Classes describing the arguments.constructorArgs
- an array of Objects for arguments.
java.lang.NoSuchMethodException
java.lang.InstantiationException
java.lang.IllegalAccessException
java.lang.IllegalArgumentException
java.lang.reflect.InvocationTargetException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |