Class IdService


  • public final class IdService
    extends java.lang.Object
    Allocates a globally unique Long number to use as an Ofy @Id.

    In non-test, non-beam environments the Id is generated by Datastore, otherwise it's from an atomic long number that's incremented every time this method is called.

    • Constructor Summary

      Constructors 
      Constructor Description
      IdService()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static long allocateId()
      Allocates an id.
      static void resetSelfAllocatedId()
      Resets the global self-allocated id counter (i.e.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • IdService

        public IdService()
    • Method Detail

      • allocateId

        public static long allocateId()
        Allocates an id.
      • resetSelfAllocatedId

        public static void resetSelfAllocatedId()
        Resets the global self-allocated id counter (i.e. sets the next id to 1).