net.walend.lyophil.test.stringbean
Class FreezableStringMother

java.lang.Object
  |
  +--net.walend.lyophil.test.stringbean.FreezableStringMother
All Implemented Interfaces:
Mother

public class FreezableStringMother
extends java.lang.Object
implements Mother

This class provides a simple helper method for making FreezableStrings.

Since:
12-31-2000
Author:
David Walend

Field Summary
private static int counter
           
 
Fields inherited from interface net.walend.lyophil.Mother
BEAN, INTERFACE, PREFIX, ROLE
 
Constructor Summary
FreezableStringMother()
           
 
Method Summary
 Freezable createEvilClone(Freezable freezy, java.lang.String role)
          Create a copy as a new instance with a new identifier.
 FreezableColorString createNewFreezableColorString(java.lang.String string, java.lang.String color)
           
 FreezableColorString createNewFreezableColorString(java.lang.String string, java.lang.String typableKey, java.lang.String color)
          Create a new FreezableString.
 FreezableString createNewFreezableString(java.lang.String string)
           
 FreezableString createNewFreezableString(java.lang.String string, java.lang.String typableKey)
          Create a new FreezableString.
 FreezableString createNewFreezableString(TestString ts)
           
 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 FreezableStringMother 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.
 FreezableColorString restoreNewFreezableColorString(java.io.Serializable id, java.lang.String string, java.lang.String color, java.lang.String typableKey)
          Create a new FreezableString instance with an old id.
 FreezableString restoreNewFreezableString(java.io.Serializable id, java.lang.String string, java.lang.String typableKey)
          Create a new FreezableString instance with an old id.
 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.
private static java.lang.String uniqueString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

counter

private static int counter
Constructor Detail

FreezableStringMother

public FreezableStringMother()
Method Detail

getInstance

public static FreezableStringMother getInstance()

createNewFreezableString

public FreezableString createNewFreezableString(java.lang.String string,
                                                java.lang.String typableKey)
Create a new FreezableString.

Throws:
CannotCreateException - if something goes wrong.

createNewFreezableString

public FreezableString createNewFreezableString(java.lang.String string)

createNewFreezableString

public FreezableString createNewFreezableString(TestString ts)

restoreNewFreezableString

public FreezableString restoreNewFreezableString(java.io.Serializable id,
                                                 java.lang.String string,
                                                 java.lang.String typableKey)
Create a new FreezableString instance with an old id.

Throws:
CannotCreateException - if something goes wrong.

createNewFreezableColorString

public FreezableColorString createNewFreezableColorString(java.lang.String string,
                                                          java.lang.String typableKey,
                                                          java.lang.String color)
Create a new FreezableString.

Throws:
CannotCreateException - if something goes wrong.

createNewFreezableColorString

public FreezableColorString createNewFreezableColorString(java.lang.String string,
                                                          java.lang.String color)

restoreNewFreezableColorString

public FreezableColorString restoreNewFreezableColorString(java.io.Serializable id,
                                                           java.lang.String string,
                                                           java.lang.String color,
                                                           java.lang.String typableKey)
Create a new FreezableString instance with an old id.

Throws:
CannotCreateException - if something goes wrong.

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.

uniqueString

private static java.lang.String uniqueString()


Copyright (c) 2000, 2001, David Walend