Class UniqueIdGeneratorImpl

    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean hasNext​()
      Tests whether the Generator is capable of generating a Generator.next() item.
      static void initSeed​()
      This method initializes the ID generator, it is invoked upon loading the utility class by the class loader (static block), though it may be called manually in case of ID collisions.
      java.lang.String next​()
      Generates a next item.
      void remove​()
      • Methods inherited from interface java.util.Iterator

        forEachRemaining
      • Methods inherited from class java.lang.Object

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

      • UniqueIdGeneratorImpl

        public UniqueIdGeneratorImpl​()
        Constructs a UniqueIdGeneratorImpl with a default ID length of 36.
      • UniqueIdGeneratorImpl

        public UniqueIdGeneratorImpl​(int aIdLength)
        Constructs a UniqueIdGeneratorImpl with the provided ID length.
        Parameters:
        aIdLength - The length for the generated IDs.
    • Method Detail

      • initSeed

        public static void initSeed​()
        This method initializes the ID generator, it is invoked upon loading the utility class by the class loader (static block), though it may be called manually in case of ID collisions. Then a new random number as starting point for a specific part of the ID and the IP address are newly set.
      • hasNext

        public boolean hasNext​()
        Tests whether the Generator is capable of generating a Generator.next() item.
        Specified by:
        hasNext in interface Generator<java.lang.String>
        Specified by:
        hasNext in interface java.util.Iterator<java.lang.String>
        Returns:
        true, if successful
      • next

        public java.lang.String next​()
        Generates a next item.
        Specified by:
        next in interface Generator<java.lang.String>
        Specified by:
        next in interface java.util.Iterator<java.lang.String>
        Returns:
        The next item generated
      • remove

        public void remove​()
        Specified by:
        remove in interface java.util.Iterator<java.lang.String>