All Implemented Interfaces:
GomCheckable, GomElement, GomFormElement, GomHideable, GomLangInfoProvider, GomSearchRelevancy, GomSingleLineable, GomTransferHandling, LineBreakable, TextGomFormElement, Serializable

@NonExtendable public class GomNumber extends GomText
GOM implementation for numbers.
Since:
3.0
See Also:
  • Field Details

  • Constructor Details

    • GomNumber

      public GomNumber()
  • Method Details

    • getDefaultTag

      protected String getDefaultTag()
      Description copied from class: AbstractGomElement
      Return the default tag for a gom element.
      Overrides:
      getDefaultTag in class GomText
      Returns:
      The elements default tag.
    • getMax

      public Double getMax()
      Maximum value of the number
      Since:
      3.0
    • setMax

      public void setMax(Double max)
      Sets the maximum value of the number
      Since:
      3.0
    • getMin

      public Double getMin()
      Minimum value of the number
      Since:
      3.0
    • setMin

      public void setMin(Double min)
      Sets the minimum value of the number
      Since:
      3.0
    • getType

      @Nullable public @Nullable NumberType getType()
      Number type.
      Returns:
      Actual number type or null.
      Since:
      3.0
      See Also:
    • setType

      public void setType(NumberType type)
      Sets the number type
      Since:
      3.0
    • getLangInfos

      public GomNumberLangInfos getLangInfos()
      Description copied from class: AbstractGomFormElement
      Provides language dependent information on this form element, like a label and description for multiple languages.
      Specified by:
      getLangInfos in interface GomLangInfoProvider
      Overrides:
      getLangInfos in class AbstractGomFormElement
      Returns:
      A language information container.
    • getPassword

      public TextDisplayMode getPassword()
      Description copied from class: GomText
      Mode for displaying the form field content
      Overrides:
      getPassword in class GomText
    • getMaxInputLength

      public PositiveInteger getMaxInputLength()
      Description copied from class: AbstractGomTextualFormElement
      Maximum number of characters allowed for input
      Overrides:
      getMaxInputLength in class AbstractGomTextualFormElement
    • getTransferTypes

      @Nullable public @Nullable List<TransferType<?>> getTransferTypes(SpecialistsBroker broker)
      Description copied from interface: GomTransferHandling
      Returns a list of supported TransferType's, or null if transfer is not supported.
      Specified by:
      getTransferTypes in interface GomTransferHandling
      Overrides:
      getTransferTypes in class GomText
      Parameters:
      broker - Broker for requesting services or providers.
      Returns:
      supported transfer types, or null.
    • type

      @NotNull public @NotNull NumberType type()
      Get the type of value, defaulting to NumberType.LONG.
      Returns:
      The type.
      Since:
      3.0
    • min

      @NotNull public @NotNull Number min()
      Get the minimum value as type-correct number.
      Returns:
      The minimum value.
      Since:
      3.0
    • max

      public Number max()
      Get the maximum value as type-correct number.
      Returns:
      The maximum value.
      Since:
      3.0
    • getDecimalFormat

      public DecimalFormat getDecimalFormat(String lang)
      Get the formatting object for the given language.
      Parameters:
      lang - The language to look up.
      Returns:
      The formatting object for the language or the default one.
      Since:
      3.0
    • parseNumber

      @Nullable public @Nullable Number parseNumber(String lang, String string) throws NumberFormatException
      Parse a string to a number using the format provided for the given language.
      Parameters:
      lang - The language for selecting the format.
      string - The string to be parsed.
      Returns:
      The parsed number or null, if string is null or empty.
      Throws:
      NumberFormatException - If the given string is not a number.
      Since:
      3.0
    • formatNumber

      @NotNull public @NotNull String formatNumber(String lang, Number number)
      Format a number to string using the format provided for the given language.
      Parameters:
      lang - The language for selecting the format.
      number - The number to be formatted.
      Returns:
      The formatted string or an empty string.
      Since:
      3.0
    • isValid

      public boolean isValid(Number number)
      Checks whether the given number contains a valid value wrt this definition.
      Parameters:
      number - The number to check.
      Returns:
      true, if the number is valid.
      Since:
      3.0
    • isInvalidType

      public boolean isInvalidType(Number number)
      Tests whether the given type is invalid wrt. the definition.
      Parameters:
      number - The number to test (Not null!)
      Since:
      3.0
    • isBelowMinimum

      public boolean isBelowMinimum(@NotNull @NotNull Number number)
      Tests, whether the given number is below the defined minimum.
      Parameters:
      number - The number to test (Not null!)
      Returns:
      true, if the given number is less than minimum.
      Since:
      3.0
    • isAboveMaximum

      public boolean isAboveMaximum(@NotNull @NotNull Number number)
      Tests, whether the given number is above the defined maximum.
      Parameters:
      number - The number to test (Not null!)
      Returns:
      true, if the given number is greater than maximum.
      Since:
      3.0