|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object nz.ac.waikato.mcennis.rat.AbstractFactory<Type>
public abstract class AbstractFactory<Type>
Base class for all Factory objects in Graph-RAT. Any new types added to Graph-RAT
should sub-class this object. The following additional static code should also be added in order
to activate automated inclusion in the DynamicLoader:
public static void initialization(){
if(instance == null){
DynamicLoader.initialization();
instance = new {Factory Constructor}();
DynamicLoader.newInstance().addFactoryType(instance);
}
}
static public {FactoryName} newInstance(){
initialization();
return instance;
}
The parameters consist of:
Field Summary | |
---|---|
protected java.util.HashMap<java.lang.String,Type> |
map
|
protected PropertiesInternal |
properties
|
Constructor Summary | |
---|---|
protected |
AbstractFactory()
Abstract Superconstructor creating metadata common to all factory objects. |
Method Summary | |
---|---|
void |
addDefaultProperty(java.lang.String type,
java.lang.Object value)
Set a default value in the factory's internal properties object. |
void |
addType(java.lang.String type,
Type prototype)
Registers the given value as a prototype linked with the given name key. |
boolean |
check(Parameter parameter)
Verify, without modifying the underlying property lists, that the given Parameter object can be merged with this factory, satisfying all constraints. |
boolean |
check(Properties props)
Verify, without modifying the underlying property lists, that the given Properties object can be merged with this factory, satisfying all constraints. |
abstract Type |
create(Properties props)
Create the given object using the settings in the Properties object. |
abstract Parameter |
getClassParameter()
Return the parameter containing the name of the default type produced by this object. |
java.util.Collection<java.lang.String> |
getKnownTypes()
Obtain a collection containing all of the string key names describing all object types this factory can produce. |
Properties |
getParameter()
Get all parameters associated with this object. |
Parameter |
getParameter(java.lang.String type)
Obtain a particular parameter with the given string as its key. |
void |
setDefaultProperty(ParameterInternal value)
Set a default value in the factory's internal properties object. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected java.util.HashMap<java.lang.String,Type> map
protected PropertiesInternal properties
Constructor Detail |
---|
protected AbstractFactory()
Method Detail |
---|
public abstract Type create(Properties props)
props
- parameters used to control the factory.
public void setDefaultProperty(ParameterInternal value)
value
- property to set as default.Properties.replace(ParameterInternal)
public void addDefaultProperty(java.lang.String type, java.lang.Object value) throws InvalidObjectTypeException
value
- property to set as default.
InvalidObjectTypeException
Properties.replace(ParameterInternal)
public Properties getParameter()
public Parameter getParameter(java.lang.String type)
type
- parameter key
public void addType(java.lang.String type, Type prototype)
type
- key that indicates that the given object should be createdprototype
- prototype of an object this factory can return.public boolean check(Properties props)
props
- Properties object that might be merged in
public boolean check(Parameter parameter)
props
- Parameter object that might be merged in
public abstract Parameter getClassParameter()
public java.util.Collection<java.lang.String> getKnownTypes()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |