Class ValueGenerationBlock<T>
- java.lang.Object
-
- org.datanucleus.store.valuegenerator.ValueGenerationBlock<T>
-
- Type Parameters:
T
- Type of the value (String, Long etc)
- All Implemented Interfaces:
java.io.Serializable
public class ValueGenerationBlock<T> extends java.lang.Object implements java.io.Serializable
Representation of a block of values.- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description private int
nextIndex
The next id position.private static long
serialVersionUID
private java.util.List<T>
valueList
The list of values in this block.
-
Constructor Summary
Constructors Constructor Description ValueGenerationBlock(java.util.List<T> oid)
Constructor.ValueGenerationBlock(T[] values)
Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addBlock(ValueGenerationBlock<T> block)
Method to append a block onto this block.T
current()
Accessor for the current value.boolean
hasNext()
Accessor for whether there are more values remaining in the block.T
next()
Accessor for the next value, or null if block values exhaustedjava.lang.String
toString()
Stringify method.
-
-
-
Field Detail
-
serialVersionUID
private static final long serialVersionUID
- See Also:
- Constant Field Values
-
nextIndex
private int nextIndex
The next id position.
-
valueList
private final java.util.List<T> valueList
The list of values in this block.
-
-
Constructor Detail
-
ValueGenerationBlock
public ValueGenerationBlock(T[] values)
Constructor.- Parameters:
values
- The block of objects that will be considered the "values"
-
ValueGenerationBlock
public ValueGenerationBlock(java.util.List<T> oid)
Constructor.- Parameters:
oid
- The list of objects that will be considered the "values"
-
-
Method Detail
-
current
public T current()
Accessor for the current value.- Returns:
- The current value
- Throws:
java.util.NoSuchElementException
- Thrown if no current value
-
next
public T next()
Accessor for the next value, or null if block values exhausted- Returns:
- The next value
-
hasNext
public boolean hasNext()
Accessor for whether there are more values remaining in the block.- Returns:
- True when has more values
-
addBlock
public void addBlock(ValueGenerationBlock<T> block)
Method to append a block onto this block. This is used where we have some values left, and we want to allocate more to go into this block.- Parameters:
block
- The other block
-
toString
public java.lang.String toString()
Stringify method.- Overrides:
toString
in classjava.lang.Object
- Returns:
- A string version of this object
-
-