net.walend.collection.lyophil
Class FreezableCollectionMother

java.lang.Object
  |
  +--net.walend.collection.lyophil.FreezableCollectionMother
All Implemented Interfaces:
Mother

public class FreezableCollectionMother
extends java.lang.Object
implements Mother

This class provides a simple helper method for making FreezableCollections.

Since:
20010213
Author:
David Walend

Field Summary
 
Fields inherited from interface net.walend.lyophil.Mother
BEAN, INTERFACE, PREFIX, ROLE
 
Constructor Summary
FreezableCollectionMother()
           
 
Method Summary
 Freezable createEvilClone(Freezable freezy, java.lang.String role)
          Create a copy as a new instance with a new identifier.
 FreezableSet createNewFreezableSet()
          Create a new FreezableSet.
 Freezable createNewInstance(java.lang.String role)
          Create a new instance of a class for the given role wanted.
 Freezable createNewInstance(java.lang.String role, java.lang.Object[] parameters)
          Create a new instance of a class for the given role wanted.
static FreezableCollectionMother getInstance()
           
 java.lang.Class getInterfaceForBeanClass(java.lang.Class beanClass)
           
 java.lang.Class getInterfaceForRole(java.lang.String role)
           
 Set getInterfaces()
           
protected  Mother getMother()
           
 java.lang.String getRoleForInterface(java.lang.Class interf)
           
 void postCreate(Freezable freezable, Mother caller)
          Mothers should call this method after creating a new instance of a Freezable.
 FreezableSet restoreNewFreezableSet(java.io.Serializable id)
          Create a new FreezableSet instance with an old id.
 FreezableSet restoreNewFreezableSet(java.io.Serializable id, FreezableSet set)
           
 Freezable restoreNewInstance(java.lang.String role, java.io.Serializable id)
          Only call this method from inside a Freezer.
 Freezable restoreNewInstance(java.lang.String role, java.io.Serializable id, java.lang.Object[] parameters)
          Only call this method from inside a Freezer.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FreezableCollectionMother

public FreezableCollectionMother()
Method Detail

getInstance

public static FreezableCollectionMother getInstance()

createNewFreezableSet

public FreezableSet createNewFreezableSet()
Create a new FreezableSet.

Throws:
CannotCreateException - if something goes wrong.

restoreNewFreezableSet

public FreezableSet restoreNewFreezableSet(java.io.Serializable id)
Create a new FreezableSet instance with an old id.

Throws:
CannotCreateException - if something goes wrong.

restoreNewFreezableSet

public FreezableSet restoreNewFreezableSet(java.io.Serializable id,
                                           FreezableSet set)

getMother

protected Mother getMother()

getInterfaces

public Set getInterfaces()
Specified by:
getInterfaces in interface Mother

getInterfaceForRole

public java.lang.Class getInterfaceForRole(java.lang.String role)
Specified by:
getInterfaceForRole in interface Mother

getRoleForInterface

public java.lang.String getRoleForInterface(java.lang.Class interf)
Specified by:
getRoleForInterface in interface Mother

getInterfaceForBeanClass

public java.lang.Class getInterfaceForBeanClass(java.lang.Class beanClass)
Specified by:
getInterfaceForBeanClass in interface Mother

postCreate

public void postCreate(Freezable freezable,
                       Mother caller)
Description copied from interface: Mother
Mothers should call this method after creating a new instance of a Freezable. It will normally freeze the new Freezable for the first time.

Specified by:
postCreate in interface Mother

createNewInstance

public Freezable createNewInstance(java.lang.String role)
Description copied from interface: Mother
Create a new instance of a class for the given role wanted. Freeze that instance immediately.

implementations should call postCreate(new freezable,this);

Specified by:
createNewInstance in interface Mother
Following copied from interface: net.walend.lyophil.Mother
Parameters:
role - the role that the Freezable should implement

createNewInstance

public Freezable createNewInstance(java.lang.String role,
                                   java.lang.Object[] parameters)
Description copied from interface: Mother
Create a new instance of a class for the given role wanted. Freeze that instance immediately.

implementations should call postCreate(new freezable,this);

Specified by:
createNewInstance in interface Mother
Following copied from interface: net.walend.lyophil.Mother
Parameters:
role - the role that the Freezable should implement
parameters - for the object's constructor.

createEvilClone

public Freezable createEvilClone(Freezable freezy,
                                 java.lang.String role)
Description copied from interface: Mother
Create a copy as a new instance with a new identifier. Freeze that instance immediately.

implementations should call postCreate(new freezable,this);

Specified by:
createEvilClone in interface Mother
Following copied from interface: net.walend.lyophil.Mother
Parameters:
freezy - the Freezable to copy.

restoreNewInstance

public Freezable restoreNewInstance(java.lang.String role,
                                    java.io.Serializable id)
Description copied from interface: Mother
Only call this method from inside a Freezer. Restore a persisted instance from a Freezer.

Specified by:
restoreNewInstance in interface Mother
Following copied from interface: net.walend.lyophil.Mother
Parameters:
role - the role that the Freezable should implement

restoreNewInstance

public Freezable restoreNewInstance(java.lang.String role,
                                    java.io.Serializable id,
                                    java.lang.Object[] parameters)
Description copied from interface: Mother
Only call this method from inside a Freezer. Restore a persisted instance from a Freezer.

Specified by:
restoreNewInstance in interface Mother
Following copied from interface: net.walend.lyophil.Mother
Parameters:
role - the role that the Freezable should implement
id - the identifier of this Freezable
parameters - for the object's constructor.


Copyright (c) 2000, 2001, David Walend