Class PKGenerator

  • All Implemented Interfaces:
    KeyGenerator

    public class PKGenerator
    extends java.lang.Object
    implements KeyGenerator
    Generates a unique PK object for a given typecode (as Integer).
    Since:
    4.0
    • Constructor Summary

      Constructors 
      Constructor Description
      PKGenerator()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.Object generate()
      Generates a new unique key.
      java.lang.Object generateFor​(java.lang.Object object)
      Generates a PK for a given typecode as Integer.
      void reset()
      Resets the key generation so that an already generated key can be generated once again.
      • Methods inherited from class java.lang.Object

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

      • PKGenerator

        public PKGenerator()
    • Method Detail

      • generate

        public java.lang.Object generate()
        Description copied from interface: KeyGenerator
        Generates a new unique key. If this method is called twice it will never return the same key twice (if key A is returned by first call and key B by second call, A does not equals B). A order of returned keys is not guaranteed (depends on implementation). After a call of the KeyGenerator.reset() method the generator is reseted so that a key can be returned which already was returned before calling KeyGenerator.reset().
        Specified by:
        generate in interface KeyGenerator
        Returns:
        unique key
      • generateFor

        public java.lang.Object generateFor​(java.lang.Object object)
        Generates a PK for a given typecode as Integer.
        Specified by:
        generateFor in interface KeyGenerator
        Parameters:
        object - object for which a key will be generated
        Returns:
        unique key in relation to given object
      • reset

        public void reset()
        Description copied from interface: KeyGenerator
        Resets the key generation so that an already generated key can be generated once again.
        Specified by:
        reset in interface KeyGenerator