Class GlobalIDFactory


  • @ThreadSafe
    public final class GlobalIDFactory
    extends Object
    This class should not be static since it may have an impact if this class is used by different projects which have a separate IntID factory.
    Author:
    Philip Helger
    • Field Detail

      • STRING_ID_MAX_LENGTH

        public static final int STRING_ID_MAX_LENGTH
        The maximum string length of IDs created by the String based ID factory.
        See Also:
        Constant Field Values
    • Method Detail

      • hasIntIDFactory

        public static boolean hasIntIDFactory()
      • getIntIDFactory

        @Nullable
        public static IIntIDFactory getIntIDFactory()
        Returns:
        The factory to create non-persistent int IDs. May be null.
      • hasPersistentIntIDFactory

        public static boolean hasPersistentIntIDFactory()
      • getPersistentIntIDFactory

        @Nullable
        public static IIntIDFactory getPersistentIntIDFactory()
        Returns:
        The factory to create persistent int IDs. May be null.
      • hasLongIDFactory

        public static boolean hasLongIDFactory()
      • getLongIDFactory

        @Nullable
        public static ILongIDFactory getLongIDFactory()
        Returns:
        The factory to create non-persistent long IDs. May be null.
      • hasPersistentLongIDFactory

        public static boolean hasPersistentLongIDFactory()
      • getPersistentLongIDFactory

        @Nullable
        public static ILongIDFactory getPersistentLongIDFactory()
        Returns:
        The factory to create persistent long IDs. May be null.
      • hasStringIDFactory

        public static boolean hasStringIDFactory()
      • getStringIDFactory

        @Nullable
        public static IStringIDFactory getStringIDFactory()
        Returns:
        The factory to create non-persistent string IDs. May be null.
      • hasPersistentStringIDFactory

        public static boolean hasPersistentStringIDFactory()
      • getPersistentStringIDFactory

        @Nullable
        public static IStringIDFactory getPersistentStringIDFactory()
        Returns:
        The factory to create persistent string IDs. May be null.
      • getNewIntID

        public static int getNewIntID()
        Returns:
        A new int ID
      • getNewPersistentIntID

        public static int getNewPersistentIntID()
        Returns:
        A new persistent int ID
      • getNewLongID

        public static long getNewLongID()
        Returns:
        A new long ID
      • getNewPersistentLongID

        public static long getNewPersistentLongID()
        Returns:
        A new persistent long ID
      • getNewStringID

        @Nonnull
        public static String getNewStringID()
        Returns:
        A new String ID
      • getNewPersistentStringID

        @Nonnull
        public static String getNewPersistentStringID()
        Returns:
        A new persistent String ID
      • getBulkNewIntIDs

        public static int[] getBulkNewIntIDs​(@Nonnegative
                                             int nCount)
        Parameters:
        nCount - The number of IDs to retrieve. Must be > 0.
        Returns:
        An array of new int IDs
      • getBulkNewPersistentIntIDs

        public static int[] getBulkNewPersistentIntIDs​(@Nonnegative
                                                       int nCount)
        Parameters:
        nCount - The number of IDs to retrieve. Must be > 0.
        Returns:
        An array of new persistent int IDs
      • getBulkNewLongIDs

        public static long[] getBulkNewLongIDs​(@Nonnegative
                                               int nCount)
        Parameters:
        nCount - The number of IDs to retrieve. Must be > 0.
        Returns:
        An array of new long IDs
      • getBulkNewPersistentLongIDs

        public static long[] getBulkNewPersistentLongIDs​(@Nonnegative
                                                         int nCount)
        Parameters:
        nCount - The number of IDs to retrieve. Must be > 0.
        Returns:
        An array of new persistent long IDs
      • getBulkNewStringIDs

        @Nonnull
        public static String[] getBulkNewStringIDs​(@Nonnegative
                                                   int nCount)
        Parameters:
        nCount - The number of IDs to retrieve
        Returns:
        An array of new String IDs
      • getBulkNewPersistentStringIDs

        @Nonnull
        public static String[] getBulkNewPersistentStringIDs​(@Nonnegative
                                                             int nCount)
        Parameters:
        nCount - The number of IDs to retrieve. Must be > 0.
        Returns:
        An array of new persistent String IDs