Class NumberSeries
- java.lang.Object
-
- de.hybris.platform.jalo.numberseries.NumberSeries
-
- All Implemented Interfaces:
java.io.Serializable
public class NumberSeries extends java.lang.Object implements java.io.SerializableRepresents a serial number generated byNumberSeriesManager.getUniqueNumber(String, int)orSerialNumberGenerator.getUniqueNumber(String).Generally unique numbers should be obtained via
NumberSeriesManager.- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static org.apache.log4j.LoggerLOGstatic intTYPE_ALPHANUMERICstatic intTYPE_NUMERIC
-
Constructor Summary
Constructors Constructor Description NumberSeries(java.lang.String key, long value, int type)Deprecated.since 5.0 - please useNumberSeries(String, long, int, String)NumberSeries(java.lang.String key, long value, int type, java.lang.String template)Creates a new number series value with the given key, value and type.NumberSeries(java.lang.String key, java.lang.String formattedValue, int type)Deprecated.since 5.0 - please useNumberSeries(String, String, int, String)NumberSeries(java.lang.String key, java.lang.String formattedValue, int type, java.lang.String template)Creates a new number series value with the given key, formatted value and type.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description protected java.lang.StringapplyPatternIfExists(java.lang.String formattedNumber)longgetCurrentNumber()Returns the long representation this value.java.lang.StringgetCurrentValue()Deprecated.since ages - usegetFormatted(int)insteadjava.lang.StringgetFormatted(int digits)Returns a formatted version of this value.java.lang.StringgetKey()The sequence key.java.lang.StringgetTemplate()The sequence template.intgetType()The sequence type.protected java.lang.StringreplaceSpecialCharacters(java.lang.String template, java.lang.String formattedNumber)voidsetCurrentValue(java.lang.String value)Deprecated.since ages - has no functionvoidsetKey(java.lang.String key)Deprecated.since ages - has no functionvoidsetTemplate(java.lang.String template)Deprecated.since ages - has no functionvoidsetType(int type)Deprecated.since ages - has no function
-
-
-
Field Detail
-
LOG
public static org.apache.log4j.Logger LOG
-
TYPE_ALPHANUMERIC
public static final int TYPE_ALPHANUMERIC
- See Also:
- Constant Field Values
-
TYPE_NUMERIC
public static final int TYPE_NUMERIC
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
NumberSeries
@Deprecated(since="5.0", forRemoval=false) public NumberSeries(java.lang.String key, java.lang.String formattedValue, int type)Deprecated.since 5.0 - please useNumberSeries(String, String, int, String)Creates a new number series value with the given key, formatted value and type.- Parameters:
key- the number series keyformattedValue- a formatted valuetype- the sequence type seeNumberGenerator.NumberSeriesConstants.TYPES- Throws:
java.lang.NumberFormatException- if the formatted value could not be parsed while calculating its long representation
-
NumberSeries
public NumberSeries(java.lang.String key, java.lang.String formattedValue, int type, java.lang.String template)Creates a new number series value with the given key, formatted value and type.- Parameters:
key- the number series keyformattedValue- a formatted valuetype- the sequence type seeNumberGenerator.NumberSeriesConstants.TYPEStemplate- the template to be applied on generated number- Throws:
java.lang.NumberFormatException- if the formatted value could not be parsed while calculating its long representation
-
NumberSeries
@Deprecated(since="5.0", forRemoval=false) public NumberSeries(java.lang.String key, long value, int type)Deprecated.since 5.0 - please useNumberSeries(String, long, int, String)Creates a new number series value with the given key, value and type.- Parameters:
key- the key of the number series valuevalue- the long valuetype- the series type
-
NumberSeries
public NumberSeries(java.lang.String key, long value, int type, java.lang.String template)Creates a new number series value with the given key, value and type.- Parameters:
key- the key of the number series valuevalue- the long valuetype- the series typetemplate- the template to be used with generated number
-
-
Method Detail
-
getCurrentNumber
public long getCurrentNumber()
Returns the long representation this value.
-
getCurrentValue
@Deprecated(since="ages", forRemoval=false) public java.lang.String getCurrentValue()Deprecated.since ages - usegetFormatted(int)insteadThe formatted value.
-
getFormatted
public java.lang.String getFormatted(int digits)
Returns a formatted version of this value. The result text contains at least the number of specified characters. If the underlying number does not fill it completely zeros are prepended.- Parameters:
digits- the number of digits to fill; if < 0 no leading zeros are prepended
-
applyPatternIfExists
protected java.lang.String applyPatternIfExists(java.lang.String formattedNumber)
-
replaceSpecialCharacters
protected java.lang.String replaceSpecialCharacters(java.lang.String template, java.lang.String formattedNumber)
-
getTemplate
public java.lang.String getTemplate()
The sequence template.
-
getKey
public java.lang.String getKey()
The sequence key.
-
getType
public int getType()
The sequence type. Should be one ofTYPE_ALPHANUMERICorTYPE_NUMERIC- otherwisegetFormatted(int)will always return numeric values.
-
setTemplate
@Deprecated(since="ages", forRemoval=false) public void setTemplate(java.lang.String template)Deprecated.since ages - has no function
-
setCurrentValue
@Deprecated(since="ages", forRemoval=false) public void setCurrentValue(java.lang.String value)Deprecated.since ages - has no function
-
setKey
@Deprecated(since="ages", forRemoval=false) public void setKey(java.lang.String key)Deprecated.since ages - has no function
-
setType
@Deprecated(since="ages", forRemoval=false) public void setType(int type)Deprecated.since ages - has no function
-
-