net.walend.lyophil.test.stringbean
Class StringBean

java.lang.Object
  |
  +--net.walend.collection.test.TestBean
        |
        +--net.walend.lyophil.test.stringbean.StringBean
All Implemented Interfaces:
Freezable, FreezableString, HasState, HasTypableKey, java.io.Serializable, TestString
Direct Known Subclasses:
ColorStringBean

public class StringBean
extends TestBean
implements FreezableString

A simple bean for tests.

Since:
12-6-2000
Author:
David Walend

Field Summary
private  java.io.Serializable id
           
private  java.lang.String role
           
private  java.lang.String typableKey
           
 
Fields inherited from class net.walend.collection.test.TestBean
 
Fields inherited from interface net.walend.lyophil.test.stringbean.FreezableString
FREEZABLESTRING
 
Constructor Summary
StringBean(java.io.Serializable identifier, java.lang.String role, Mother mom, StringBean sb)
           
StringBean(java.io.Serializable identifier, java.lang.String role, Mother mom, java.lang.String string, java.lang.String typableKey)
           
 
Method Summary
 Freezable createEvilClone(Mother mom, java.lang.String role)
          Returns a new instance of a Freezable with the same internal state as this Freezable, but with the new id.
 java.lang.String getCloneKey()
          Get a clone key
 java.io.Serializable getIdentifier()
          Get the identifier for this instance.
 java.lang.Class getPrincipleInterface()
          Returns the class's principle interface for state comparisons.
 java.lang.String getRole()
          Get the role for this instance.
 java.lang.String getTypableKey()
          Return the typable key.
 boolean sameAs(Freezable object)
          Returns true if this Freezable represents the samee information as object, and their internal state matches.
 boolean sameIdentifierAs(Freezable object)
          Returns true if this Freezable represents the same information as the Freezable object, ie if they have the same identifier.
 boolean sameStateAs(HasState object)
          If two HasStates have the same internal state, return true.
 void setTypableKey(java.lang.String key)
          Set the typable key
 java.lang.String toString()
           
 
Methods inherited from class net.walend.collection.test.TestBean
getString, setString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface net.walend.lyophil.test.stringbean.FreezableString
getString, setString
 

Field Detail

id

private java.io.Serializable id

role

private java.lang.String role

typableKey

private java.lang.String typableKey
Constructor Detail

StringBean

public StringBean(java.io.Serializable identifier,
                  java.lang.String role,
                  Mother mom,
                  java.lang.String string,
                  java.lang.String typableKey)

StringBean

public StringBean(java.io.Serializable identifier,
                  java.lang.String role,
                  Mother mom,
                  StringBean sb)
Method Detail

getIdentifier

public java.io.Serializable getIdentifier()
Description copied from interface: Freezable
Get the identifier for this instance. I've always used a Long, but the ejb spec says it can be anything. Try to use something immutable. Note that you will only have this Object plus metadetails of the class to use for identifier information. All you should need is the identifier.

Specified by:
getIdentifier in interface Freezable

getRole

public java.lang.String getRole()
Description copied from interface: Freezable
Get the role for this instance.

Specified by:
getRole in interface Freezable

sameIdentifierAs

public boolean sameIdentifierAs(Freezable object)
Description copied from interface: Freezable
Returns true if this Freezable represents the same information as the Freezable object, ie if they have the same identifier.

Specified by:
sameIdentifierAs in interface Freezable

getPrincipleInterface

public java.lang.Class getPrincipleInterface()
Description copied from interface: HasState
Returns the class's principle interface for state comparisons. If two objects have different principle interfaces, they never have the same state.

Specified by:
getPrincipleInterface in interface HasState
Overrides:
getPrincipleInterface in class TestBean

sameStateAs

public boolean sameStateAs(HasState object)
Description copied from interface: HasState
If two HasStates have the same internal state, return true.

For objects with subobjects, Generally this method should only return true if the internal objects are equal. Implement a contentsHaveSameState() method to determine if the contents have the same state.

Specified by:
sameStateAs in interface HasState
Overrides:
sameStateAs in class TestBean

sameAs

public boolean sameAs(Freezable object)
Description copied from interface: Freezable
Returns true if this Freezable represents the samee information as object, and their internal state matches.

Specified by:
sameAs in interface Freezable

getTypableKey

public java.lang.String getTypableKey()
Description copied from interface: HasTypableKey
Return the typable key.

Specified by:
getTypableKey in interface HasTypableKey

setTypableKey

public void setTypableKey(java.lang.String key)
Description copied from interface: HasTypableKey
Set the typable key

Specified by:
setTypableKey in interface HasTypableKey

getCloneKey

public java.lang.String getCloneKey()
Description copied from interface: HasTypableKey
Get a clone key

Specified by:
getCloneKey in interface HasTypableKey

createEvilClone

public Freezable createEvilClone(Mother mom,
                                 java.lang.String role)
Description copied from interface: Freezable
Returns a new instance of a Freezable with the same internal state as this Freezable, but with the new id. This method should only be called by Mother.

Specified by:
createEvilClone in interface Freezable

toString

public java.lang.String toString()
Specified by:
toString in interface TestString
Overrides:
toString in class TestBean


Copyright (c) 2000, 2001, David Walend