Class NumberSeries

java.lang.Object
de.hybris.platform.jalo.numberseries.NumberSeries
All Implemented Interfaces:
Serializable

public class NumberSeries extends Object implements Serializable
Represents a serial number generated by NumberSeriesManager.getUniqueNumber(String, int) or SerialNumberGenerator.getUniqueNumber(String).

Generally unique numbers should be obtained via NumberSeriesManager.

See Also:
  • Field Details

    • LOG

      public static org.apache.log4j.Logger LOG
    • TYPE_ALPHANUMERIC

      public static final int TYPE_ALPHANUMERIC
      See Also:
    • TYPE_NUMERIC

      public static final int TYPE_NUMERIC
      See Also:
  • Constructor Details

    • NumberSeries

      @Deprecated(since="5.0", forRemoval=false) public NumberSeries(String key, String formattedValue, int type)
      Deprecated.
      Creates a new number series value with the given key, formatted value and type.
      Parameters:
      key - the number series key
      formattedValue - a formatted value
      type - the sequence type see NumberGenerator.NumberSeriesConstants.TYPES
      Throws:
      NumberFormatException - if the formatted value could not be parsed while calculating its long representation
    • NumberSeries

      public NumberSeries(String key, String formattedValue, int type, String template)
      Creates a new number series value with the given key, formatted value and type.
      Parameters:
      key - the number series key
      formattedValue - a formatted value
      type - the sequence type see NumberGenerator.NumberSeriesConstants.TYPES
      template - the template to be applied on generated number
      Throws:
      NumberFormatException - if the formatted value could not be parsed while calculating its long representation
    • NumberSeries

      @Deprecated(since="5.0", forRemoval=false) public NumberSeries(String key, long value, int type)
      Deprecated.
      Creates a new number series value with the given key, value and type.
      Parameters:
      key - the key of the number series value
      value - the long value
      type - the series type
    • NumberSeries

      public NumberSeries(String key, long value, int type, String template)
      Creates a new number series value with the given key, value and type.
      Parameters:
      key - the key of the number series value
      value - the long value
      type - the series type
      template - the template to be used with generated number
  • Method Details

    • getCurrentNumber

      public long getCurrentNumber()
      Returns the long representation this value.
    • getCurrentValue

      @Deprecated(since="ages", forRemoval=false) public String getCurrentValue()
      Deprecated.
      since ages - usegetFormatted(int) instead
      The formatted value.
    • getFormatted

      public 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 String applyPatternIfExists(String formattedNumber)
    • replaceSpecialCharacters

      protected String replaceSpecialCharacters(String template, String formattedNumber)
    • getTemplate

      public String getTemplate()
      The sequence template.
    • getKey

      public String getKey()
      The sequence key.
    • getType

      public int getType()
      The sequence type. Should be one of TYPE_ALPHANUMERIC or TYPE_NUMERIC - otherwise getFormatted(int) will always return numeric values.
    • setTemplate

      @Deprecated(since="ages", forRemoval=false) public void setTemplate(String template)
      Deprecated.
      since ages - has no function
    • setCurrentValue

      @Deprecated(since="ages", forRemoval=false) public void setCurrentValue(String value)
      Deprecated.
      since ages - has no function
    • setKey

      @Deprecated(since="ages", forRemoval=false) public void setKey(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