org.spicefactory.cinnamon.io.mapping
Class FactoryHandler<T>

java.lang.Object
  extended by org.spicefactory.cinnamon.io.mapping.FactoryHandler<T>

public class FactoryHandler<T>
extends Object

Wraps an instance of MappedObjectFactory, for internal use only. The wrapping of the factory allows for deferred resolution of an bidirectional association to a factory that has not been fully initialized yet.

Author:
Jens Halm

Constructor Summary
FactoryHandler(MappedObjectFactory<T> factory)
          Creates a new FactoryHandler wrapping the given factory.
 
Method Summary
 void addReferer(Referer referer)
          Adds a referer to this instance representing a property whose value needs to be set to the final target instance the wrapped factory of this instance will create once it is fully initialized.
 T createInstance()
          Creates the target instance and resolves all associations to the target instance that were added to this instance with the addReferer method.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FactoryHandler

public FactoryHandler(MappedObjectFactory<T> factory)
Creates a new FactoryHandler wrapping the given factory.

Parameters:
factory -
Method Detail

addReferer

public void addReferer(Referer referer)
Adds a referer to this instance representing a property whose value needs to be set to the final target instance the wrapped factory of this instance will create once it is fully initialized.

Parameters:
referer - the referer to add to this FactoryHandler

createInstance

public T createInstance()
Creates the target instance and resolves all associations to the target instance that were added to this instance with the addReferer method.

Returns:
a new and fully resolved instance