Package com.helger.commons.id.factory
Class GlobalIDFactory
- java.lang.Object
-
- com.helger.commons.id.factory.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 Summary
Fields Modifier and Type Field Description static StringDEFAULT_PREFIXThe default prefix to use for creating IDsstatic intSTRING_ID_MAX_LENGTHThe maximum string length of IDs created by the String based ID factory.
-
Method Summary
-
-
-
Field Detail
-
DEFAULT_PREFIX
public static final String DEFAULT_PREFIX
The default prefix to use for creating IDs- See Also:
- Constant Field Values
-
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.
-
setIntIDFactory
@Nonnull public static EChange setIntIDFactory(@Nullable IIntIDFactory aFactory)
-
hasPersistentIntIDFactory
public static boolean hasPersistentIntIDFactory()
-
getPersistentIntIDFactory
@Nullable public static IIntIDFactory getPersistentIntIDFactory()
- Returns:
- The factory to create persistent int IDs. May be
null.
-
setPersistentIntIDFactory
@Nonnull public static EChange setPersistentIntIDFactory(@Nullable IIntIDFactory aFactory)
-
hasLongIDFactory
public static boolean hasLongIDFactory()
-
getLongIDFactory
@Nullable public static ILongIDFactory getLongIDFactory()
- Returns:
- The factory to create non-persistent long IDs. May be
null.
-
setLongIDFactory
@Nonnull public static EChange setLongIDFactory(@Nullable ILongIDFactory aFactory)
-
hasPersistentLongIDFactory
public static boolean hasPersistentLongIDFactory()
-
getPersistentLongIDFactory
@Nullable public static ILongIDFactory getPersistentLongIDFactory()
- Returns:
- The factory to create persistent long IDs. May be
null.
-
setPersistentLongIDFactory
@Nonnull public static EChange setPersistentLongIDFactory(@Nullable ILongIDFactory aFactory)
-
hasStringIDFactory
public static boolean hasStringIDFactory()
-
getStringIDFactory
@Nullable public static IStringIDFactory getStringIDFactory()
- Returns:
- The factory to create non-persistent string IDs. May be
null.
-
setStringIDFactory
@Nonnull public static EChange setStringIDFactory(@Nullable IStringIDFactory aFactory)
-
hasPersistentStringIDFactory
public static boolean hasPersistentStringIDFactory()
-
getPersistentStringIDFactory
@Nullable public static IStringIDFactory getPersistentStringIDFactory()
- Returns:
- The factory to create persistent string IDs. May be
null.
-
setPersistentStringIDFactory
@Nonnull public static EChange setPersistentStringIDFactory(@Nullable IStringIDFactory aFactory)
-
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
-
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
-
-