Package com.helger.base.id.factory
Class MemoryStaticIntIDFactory
java.lang.Object
com.helger.base.id.factory.MemoryStaticIntIDFactory
- All Implemented Interfaces:
IBaseIDFactory,IIntIDFactory
An implementation of
IIntIDFactory using a single static
AtomicInteger.- 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 int INITIAL_IDThe default start ID to use.- See Also:
-
-
Constructor Details
-
MemoryStaticIntIDFactory
public MemoryStaticIntIDFactory()Create a new instance using the shared static counter.
-
-
Method Details
-
getNewID
@Nonnegative public int getNewID()Create a new unique integer ID.- Specified by:
getNewIDin interfaceIIntIDFactory- Returns:
- The newly created ID.
-
getNewStaticID
@Nonnegative public static int getNewStaticID()Get a new unique int ID from the static counter.- Returns:
- A new unique int ID. Always ≥ 0.
-
equals
-
hashCode
public int hashCode() -
toString
-