Package com.helger.base.id.factory
Class MemoryStaticLongIDFactory
java.lang.Object
com.helger.base.id.factory.MemoryStaticLongIDFactory
- All Implemented Interfaces:
IBaseIDFactory,ILongIDFactory
An implementation of
ILongIDFactory using a single static
AtomicLong.- Author:
- Philip Helger
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionCreate a new instance using the shared static counter. -
Method Summary
-
Field Details
-
INITIAL_ID
public static final long INITIAL_IDThe default start ID to use.- See Also:
-
-
Constructor Details
-
MemoryStaticLongIDFactory
public MemoryStaticLongIDFactory()Create a new instance using the shared static counter.
-
-
Method Details
-
getNewID
@Nonnegative public long getNewID()Create a new unique long ID.- Specified by:
getNewIDin interfaceILongIDFactory- Returns:
- The newly created ID.
-
getNewStaticID
@Nonnegative public static long getNewStaticID()Get a new unique long ID from the static counter.- Returns:
- A new unique long ID. Always ≥ 0.
-
equals
-
hashCode
public int hashCode() -
toString
-