Class IdGenerator<C,​V>

  • Type Parameters:
    C - category type
    V - value type

    public class IdGenerator<C,​V>
    extends java.lang.Object
    Assigns sequential numerical ids for values, unique within a category.
    • Constructor Summary

      Constructors 
      Constructor Description
      IdGenerator()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      int getId​(C category, V value)
      Get unique id for combination of category and value.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • IdGenerator

        public IdGenerator()
    • Method Detail

      • getId

        public int getId​(C category,
                         V value)
        Get unique id for combination of category and value. null values are always unique. This is not thread-safe at the moment.
        Parameters:
        category - category
        value - value, may be null
        Returns:
        assigned id, starting from 1