org.jpox.metadata
Class VersionStrategy

java.lang.Object
  extended byorg.jpox.metadata.VersionStrategy
All Implemented Interfaces:
java.io.Serializable

public class VersionStrategy
extends java.lang.Object
implements java.io.Serializable

Three common strategies for versioning instances are supported by standard metadata. These include state-comparison, timestamp, and version-number. state-image involves comparing the values in specific columns to determine if the database row was changed. date-time involves comparing the value in a date-time column in the table. The first time in a transaction the row is updated, the timestamp value is updated to the current time. version-number involves comparing the value in a numeric column in the table. The first time in a transaction the row is updated, the version-number column value is incremented.

Version:
$Revision: 1.4 $
Author:
Erik Bengtson
See Also:
Serialized Form

Field Summary
static VersionStrategy DATE_TIME
          strategy="date-time"
static VersionStrategy STATE_IMAGE
          strategy="state-image"
static VersionStrategy VERSION_NUMBER
          strategy="version-number"
 
Method Summary
 boolean equals(java.lang.Object o)
          Indicates whether some other object is "equal to" this one.
protected  int getType()
           
static VersionStrategy getVersionStrategy(java.lang.String value)
          Return VersionStrategy from String.
 java.lang.String toString()
          Returns a string representation of the object.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

STATE_IMAGE

public static final VersionStrategy STATE_IMAGE
strategy="state-image"


DATE_TIME

public static final VersionStrategy DATE_TIME
strategy="date-time"


VERSION_NUMBER

public static final VersionStrategy VERSION_NUMBER
strategy="version-number"

Method Detail

equals

public boolean equals(java.lang.Object o)
Indicates whether some other object is "equal to" this one.

Parameters:
o - the reference object with which to compare.
Returns:
true if this object is the same as the obj argument; false otherwise.

toString

public java.lang.String toString()
Returns a string representation of the object.

Returns:
a string representation of the object.

getType

protected int getType()

getVersionStrategy

public static VersionStrategy getVersionStrategy(java.lang.String value)
Return VersionStrategy from String.

Parameters:
value - strategy attribute value
Returns:
Instance of VersionStrategy. If value invalid, return null.


Copyright © -2007 . All Rights Reserved.