Class 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.
    • 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 exhausted
      java.lang.String toString()
      Stringify method.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Field Detail

      • 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 class java.lang.Object
        Returns:
        A string version of this object