org.datanucleus.store.db4o.valuegenerator
Class NucleusSequence

java.lang.Object
  extended by org.datanucleus.store.db4o.valuegenerator.NucleusSequence

public class NucleusSequence
extends java.lang.Object

Representation of a sequence for either a class or field. Object is stored in DB4O storing the class/field name and the current sequence value. Works in a similar way to SequenceTable for RDBMS in that an object is persisted for which class or field that needs sequence values and when a new one is required the object is retrieved and the sequence value updated.

Version:
$Revision: 1.1 $

Constructor Summary
NucleusSequence(java.lang.String entity)
          Constructor.
 
Method Summary
 long getCurrentValue()
          Accessor for the current value.
 java.lang.String getEntityName()
          Accessor for the entity name
 void incrementCurrentValue(long increment)
          Method to update the current value.
 void setCurrentValue(long value)
          Mutator for current value
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

NucleusSequence

public NucleusSequence(java.lang.String entity)
Constructor.

Parameters:
entity - The class/field name that the sequence value is for
Method Detail

getCurrentValue

public long getCurrentValue()
Accessor for the current value.

Returns:
Current value

getEntityName

public java.lang.String getEntityName()
Accessor for the entity name

Returns:
Entity (class/field) name

setCurrentValue

public void setCurrentValue(long value)
Mutator for current value

Parameters:
value - The current value for this sequence.

incrementCurrentValue

public void incrementCurrentValue(long increment)
Method to update the current value. TODO Think about changing this so we pass in the increment value in the constructor and just have an increment() method.

Parameters:
increment - The amount to increment by (must be positive)


Copyright © 2012. All Rights Reserved.