nz.ac.waikato.mcennis.rat.graph.property
Class PropertyTypeRegister

java.lang.Object
  extended by nz.ac.waikato.mcennis.rat.graph.property.PropertyTypeRegister

public class PropertyTypeRegister
extends java.lang.Object

Singleton registry object for obtaining PropertyValueFactory objects of the given class without needing to hard-code the classes in the parsers.


Constructor Summary
protected PropertyTypeRegister()
           
 
Method Summary
 void addFactory(java.lang.Class type, PropertyValueFactory value)
          Register the given factory for the given class of objects.
 PropertyValueFactory getFactory(java.lang.Class type)
          Get the appropriate factory of this type using a class object of the given type as a key.
static PropertyTypeRegister newInstance()
          Obtain a static instance of this class, creeeating if necessary
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PropertyTypeRegister

protected PropertyTypeRegister()
Method Detail

newInstance

public static PropertyTypeRegister newInstance()
Obtain a static instance of this class, creeeating if necessary

Returns:
static instance of this object

getFactory

public PropertyValueFactory getFactory(java.lang.Class type)
Get the appropriate factory of this type using a class object of the given type as a key. Returns null if no factory exists for the given object

Parameters:
type - class object describing the class of what is to be4 serialized or deserialized
Returns:
factory for processing this class type or null

addFactory

public void addFactory(java.lang.Class type,
                       PropertyValueFactory value)
Register the given factory for the given class of objects. This replaces silently if anonther factory is already registered for this class.

Parameters:
type - class this factory serializes
value - factory to perform the serialization