Class SystemTimeGenerator
- java.lang.Object
-
- de.hybris.platform.servicelayer.keygenerator.impl.SystemTimeGenerator
-
- All Implemented Interfaces:
KeyGenerator
public class SystemTimeGenerator extends java.lang.Object implements KeyGenerator
Generates a key by returning the current time in millis. ATTENTION: is only unique if not called more than once in a milli second.- Since:
- 4.0
-
-
Constructor Summary
Constructors Constructor Description SystemTimeGenerator()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.Objectgenerate()Generates a new unique key.java.lang.ObjectgenerateFor(java.lang.Object object)Generates a new unique key in relation to given object.voidreset()Resets the key generation so that an already generated key can be generated once again.
-
-
-
Method Detail
-
generate
public java.lang.Object generate()
Description copied from interface:KeyGeneratorGenerates 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 theKeyGenerator.reset()method the generator is reseted so that a key can be returned which already was returned before callingKeyGenerator.reset().- Specified by:
generatein interfaceKeyGenerator- Returns:
- unique key
-
generateFor
public java.lang.Object generateFor(java.lang.Object object)
Description copied from interface:KeyGeneratorGenerates a new unique key in relation to given object. The key will be unique overall as inKeyGenerator.generate()method and furthermore it is guaranteed that the key will only be produced for this object (think of a PK which contains the type information, a media PK will not be generated for a product, nevertheless it is unique overall).- Specified by:
generateForin interfaceKeyGenerator- 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:KeyGeneratorResets the key generation so that an already generated key can be generated once again.- Specified by:
resetin interfaceKeyGenerator
-
-