Package org.goplanit.utils.id
Class IdGroupingToken
- java.lang.Object
-
- org.goplanit.utils.id.IdGroupingToken
-
public final class IdGroupingToken extends Object
Class used as token to group ids, i.e., ids for a class generated with this token will be unique within this group. This allows you to have different groups of ids that are unique within each group but not between groups. An example of when this is useful is if you have multiple instances of container classes (maps, sets) that hold objects that should have unique, continguous ids within this container but NOT across containers, i.e., if a new instances is added to another container it should not lead to a gap in the ids in the other container. We use the UUID library to generate the token.- Author:
- markr
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
IdGroupingToken(String description)
Constructor
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static IdGroupingToken
collectGlobalToken()
We have one default global token available for ids that are globally managed rather than within some container.boolean
equals(Object obj)
int
hashCode()
String
toString()
collect the string token
-
-
-
Constructor Detail
-
IdGroupingToken
protected IdGroupingToken(String description)
Constructor- Parameters:
description
- of the grouping id, when null empty string is used
-
-
Method Detail
-
collectGlobalToken
public static IdGroupingToken collectGlobalToken()
We have one default global token available for ids that are globally managed rather than within some container. In that case use the global token- Returns:
- the global id token
-
-