Class TimeSeededSeq

  • All Implemented Interfaces:
    Seq, Closeable

    public class TimeSeededSeq
    extends java.lang.Object
    implements Seq
    A simplistic implementation of a Seq used to provide datastore ids. Starts with an id equal to the system's current time in milliseconds and increments from there.
    Author:
    Greg Campbell
    • Constructor Detail

      • TimeSeededSeq

        public TimeSeededSeq()
    • Method Detail

      • setType

        public void setType​(int type)
        Description copied from interface: Seq
        Set the type of sequence.
        Specified by:
        setType in interface Seq
      • getIncrement

        public int getIncrement()
      • setIncrement

        public void setIncrement​(int increment)
      • next

        public java.lang.Object next​(StoreContext ctx,
                                     ClassMetaData meta)
        Description copied from interface: Seq
        Return the next value in the sequence.
        Specified by:
        next in interface Seq
        Parameters:
        ctx - the current context
        meta - if this is a datastore identity sequence, the persistent class the identity value is for; else null
      • current

        public java.lang.Object current​(StoreContext ctx,
                                        ClassMetaData meta)
        Description copied from interface: Seq
        Return the current value of the sequence, or null if not available.
        Specified by:
        current in interface Seq
        Parameters:
        ctx - the current context
        meta - if this is a datastore identity sequence, the persistent class the identity value is for; else null
      • allocate

        public void allocate​(int additional,
                             StoreContext ctx,
                             ClassMetaData meta)
        Description copied from interface: Seq
        Allocate additional values efficiently.
        Specified by:
        allocate in interface Seq
        ctx - the current context
        meta - if this is a datastore identity sequence, the persistent class the identity value is for; else null
      • close

        public void close()
        Description copied from interface: Seq
        Free resources used by this sequence.
        Specified by:
        close in interface Closeable
        Specified by:
        close in interface Seq