@Component(value="cuba_UniqueNumbers") public class UniqueNumbers extends java.lang.Object implements UniqueNumbersAPI
Modifier and Type | Field and Description |
---|---|
protected Sequences |
sequences |
NAME
Constructor and Description |
---|
UniqueNumbers() |
Modifier and Type | Method and Description |
---|---|
void |
deleteSequence(java.lang.String domain)
Removes sequence with specified identifier
|
long |
getCurrentNumber(java.lang.String domain)
Returns the current value of the sequence.
|
protected java.lang.String |
getDataStore(java.lang.String domain)
Override this method if you want to control in what datastore a sequence is created for a particular domain
|
long |
getNextNumber(java.lang.String domain)
Returns the next sequence value.
|
protected java.lang.String |
getSequenceName(java.lang.String domain) |
void |
setCurrentNumber(java.lang.String domain,
long value)
Set current value for the sequence.
|
@Inject protected Sequences sequences
public long getNextNumber(java.lang.String domain)
UniqueNumbersAPI
getNextNumber
in interface UniqueNumbersAPI
domain
- sequence identifierpublic long getCurrentNumber(java.lang.String domain)
UniqueNumbersAPI
UniqueNumbersAPI.getNextNumber(String)
must be called at least once beforehand.getCurrentNumber
in interface UniqueNumbersAPI
domain
- sequence identifierpublic void setCurrentNumber(java.lang.String domain, long value)
UniqueNumbersAPI
UniqueNumbersAPI.getCurrentNumber(String)
invocation will return value
Next UniqueNumbersAPI.getNextNumber(String)
invocation will return value + increment
setCurrentNumber
in interface UniqueNumbersAPI
domain
- sequence identifiervalue
- valuepublic void deleteSequence(java.lang.String domain)
UniqueNumbersAPI
deleteSequence
in interface UniqueNumbersAPI
domain
- sequence identifierprotected java.lang.String getDataStore(java.lang.String domain)
domain
- sequence identifier passed to the interface methodsprotected java.lang.String getSequenceName(java.lang.String domain)