Class 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 Detail

      • IdGroupingToken

        protected IdGroupingToken​(String description)
        Constructor
        Parameters:
        description - of the grouping id, when null empty string is used
    • Method Detail

      • toString

        public String toString()
        collect the string token
        Overrides:
        toString in class Object
      • 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