Class PercentType

All Implemented Interfaces:
Serializable, Comparable<DecimalType>, Command, PrimitiveType, State, Type
Direct Known Subclasses:
HSBType

@NonNullByDefault public class PercentType extends DecimalType
The PercentType extends the DecimalType by putting constraints for its value on top (0-100).
Author:
Kai Kreuzer - Initial contribution
See Also:
  • Field Details

  • Constructor Details

    • PercentType

      public PercentType()
      Creates a new PercentType with 0 as value.
    • PercentType

      public PercentType(int value)
      Creates a new PercentType with the given value.
      Parameters:
      value - the value representing a percentage
      Throws:
      IllegalArgumentException - when the value is not between 0 and 100
    • PercentType

      public PercentType(String value)
      Creates a new PercentType with the given value. The English locale is used to determine (decimal/grouping) separator characters.
      Parameters:
      value - the non null value representing a percentage
      Throws:
      NumberFormatException - when the number could not be parsed to a BigDecimal
      IllegalArgumentException - when the value is not between 0 and 100
    • PercentType

      public PercentType(String value, Locale locale)
      Creates a new PercentType with the given value.
      Parameters:
      value - the non null value representing a percentage
      locale - the locale used to determine (decimal/grouping) separator characters
      Throws:
      NumberFormatException - when the number could not be parsed to a BigDecimal
      IllegalArgumentException - when the value is not between 0 and 100
    • PercentType

      public PercentType(BigDecimal value)
      Creates a new PercentType with the given value.
      Parameters:
      value - the value representing a percentage.
      Throws:
      IllegalArgumentException - when the value is not between 0 and 100
  • Method Details