Class PrefixablePersistentKeyGenerator

  • All Implemented Interfaces:
    KeyGenerator

    public class PrefixablePersistentKeyGenerator
    extends PersistentKeyGenerator
    This implementation is an adapter to the NumberSeries functionality of the platform for getting unique numbers in a series persisted via database. It provides several setter methods for configuration of the used number series like the key of the series at database. After configuration you should call the PersistentKeyGenerator.init() method for assuring that the series is created.
    Since:
    4.0
    • Constructor Detail

      • PrefixablePersistentKeyGenerator

        public PrefixablePersistentKeyGenerator()
    • 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
        Overrides:
        generate in class PersistentKeyGenerator
        Returns:
        unique key
      • getPrefix

        protected java.lang.String getPrefix()
        Returns:
        the prefix
      • setPrefix

        public void setPrefix​(java.lang.String prefix)
        Parameters:
        prefix - the prefix to set