Class PrefixablePersistentKeyGenerator

java.lang.Object
de.hybris.platform.servicelayer.keygenerator.impl.PersistentKeyGenerator
de.hybris.platform.chinesepaymentmock.services.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:
21.05
  • Constructor Details

    • PrefixablePersistentKeyGenerator

      public PrefixablePersistentKeyGenerator()
  • Method Details

    • generate

      public 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 String getPrefix()
      Returns:
      the prefix
    • setPrefix

      public void setPrefix(String prefix)
      Parameters:
      prefix - the prefix to set