|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.datanucleus.store.valuegenerator.AbstractGenerator
public abstract class AbstractGenerator
Abstract value generator.
| Field Summary | |
|---|---|
protected int |
allocationSize
Allocation size |
protected ValueGenerationBlock |
block
The current block of values that have been reserved. |
protected int |
initialValue
Initial value (of the first id). |
protected static Localiser |
LOCALISER
Localisation of messages |
protected java.lang.String |
name
Symbolic name for the sequence. |
protected java.util.Properties |
properties
Properties controlling the generator behaviour. |
protected boolean |
repositoryExists
Flag for whether we know that the repository exists. |
| Constructor Summary | |
|---|---|
AbstractGenerator(java.lang.String name,
java.util.Properties props)
Constructor. |
|
| Method Summary | |
|---|---|
void |
allocate(int additional)
Method to allocate a number of values into the block. |
protected boolean |
createRepository()
Method to create any needed repository for the ids. |
java.lang.Object |
current()
Accessor for the current value allocated. |
long |
currentValue()
Accessor for the current element in the sequence as a long. |
java.lang.String |
getName()
Accessor for the symbolic name for this generator. |
static java.lang.Class |
getStorageClass()
Accessor for the storage class for values generated with this generator. |
java.lang.Object |
next()
Get next value from the reserved block of values. |
long |
nextValue()
Accessor for the next element in the sequence as a long. |
protected ValueGenerationBlock |
obtainGenerationBlock()
Get a new block with the default number of values. |
protected ValueGenerationBlock |
obtainGenerationBlock(int number)
Get a new block with the specified number of values. |
protected boolean |
repositoryExists()
Method to return if the repository already exists. |
protected boolean |
requiresRepository()
Indicator for whether the generator requires its own repository. |
protected ValueGenerationBlock |
reserveBlock()
Method to reserve a default sized block of values. |
protected abstract ValueGenerationBlock |
reserveBlock(long size)
Method to reserve a block of "size" values. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected static final Localiser LOCALISER
protected java.lang.String name
protected java.util.Properties properties
protected int allocationSize
protected int initialValue
protected ValueGenerationBlock block
protected boolean repositoryExists
| Constructor Detail |
|---|
public AbstractGenerator(java.lang.String name,
java.util.Properties props)
name - Symbolic name for this generatorprops - Properties controlling the behaviour of the generator (or null if not required).| Method Detail |
|---|
public static java.lang.Class getStorageClass()
public java.lang.String getName()
getName in interface ValueGeneratorpublic java.lang.Object next()
next in interface ValueGeneratorpublic java.lang.Object current()
current in interface ValueGeneratorpublic long nextValue()
nextValue in interface ValueGeneratorNucleusDataStoreException - Thrown if not numericpublic long currentValue()
currentValue in interface ValueGeneratorNucleusDataStoreException - Thrown if not numericpublic void allocate(int additional)
allocate in interface ValueGeneratoradditional - The number to allocateprotected ValueGenerationBlock obtainGenerationBlock()
protected ValueGenerationBlock obtainGenerationBlock(int number)
number - The number of additional values required
protected ValueGenerationBlock reserveBlock()
protected abstract ValueGenerationBlock reserveBlock(long size)
size - Number of values to reserve
protected boolean requiresRepository()
protected boolean repositoryExists()
protected boolean createRepository()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||