org.bsf.smartValueObject
Class Version

java.lang.Object
  |
  +--org.bsf.smartValueObject.Version
All Implemented Interfaces:
java.io.Serializable, Versionable

public class Version
extends java.lang.Object
implements Versionable

Concrete default implementation of Versionable.

Versioning is done with timestamping.

See Also:
Serialized Form

Field Summary
private  boolean created
           
private  boolean debug
           
private  boolean deleted
           
private  boolean dirty
           
private  long timestamp
           
 
Constructor Summary
Version()
          Creates a clean version.
Version(java.lang.Object o)
          No specific purpose constructor, needed to satisfy a javassist requirement.
 
Method Summary
 void create()
          Mark object as created.
 void delete()
          Mark object for deletion.
 long getVersionId()
          Gets the version number.
 boolean isCreated()
          Has object been newly created ?
 boolean isDeleted()
          Has object been deleted ?
 boolean isDirty()
          Is object dirty ?
 void markClean()
          Resets flags.
 void setVersionId(long id)
          Sets the version number
 java.lang.String toString()
           
 void touch()
          Touches the object.
 void touch(java.lang.String field)
          Touches the object, detailling which field has been accessed.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

timestamp

private long timestamp

dirty

private boolean dirty

created

private boolean created

deleted

private boolean deleted

debug

private final boolean debug
See Also:
Constant Field Values
Constructor Detail

Version

public Version()
Creates a clean version. Timestamp is set to current time.


Version

public Version(java.lang.Object o)
No specific purpose constructor, needed to satisfy a javassist requirement.

Parameters:
o - ignored
Method Detail

touch

public void touch()
Description copied from interface: Versionable
Touches the object. Signals that a field has been written to.

Specified by:
touch in interface Versionable

touch

public void touch(java.lang.String field)
Description copied from interface: Versionable
Touches the object, detailling which field has been accessed.

Specified by:
touch in interface Versionable
Parameters:
field - which was touched

delete

public void delete()
Description copied from interface: Versionable
Mark object for deletion.

Specified by:
delete in interface Versionable

create

public void create()
Description copied from interface: Versionable
Mark object as created.

Specified by:
create in interface Versionable

isCreated

public boolean isCreated()
Description copied from interface: Versionable
Has object been newly created ?

Specified by:
isCreated in interface Versionable

isDeleted

public boolean isDeleted()
Description copied from interface: Versionable
Has object been deleted ?

Specified by:
isDeleted in interface Versionable

isDirty

public boolean isDirty()
Description copied from interface: Versionable
Is object dirty ?

Specified by:
isDirty in interface Versionable

markClean

public void markClean()
Description copied from interface: Versionable
Resets flags.

Specified by:
markClean in interface Versionable

getVersionId

public long getVersionId()
Gets the version number.

Specified by:
getVersionId in interface Versionable

setVersionId

public void setVersionId(long id)
Sets the version number

Specified by:
setVersionId in interface Versionable

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object