Package org.zkoss.zul

## Class SimpleNumberInputConstraint<T extends java.lang.Number & java.lang.Comparable<T>>

- java.lang.Object
- - org.zkoss.zul.SimpleConstraint
  - - org.zkoss.zul.SimpleNumberInputConstraint<T>

- All Implemented Interfaces:
    `java.io.Serializable`, `ClientConstraint`, `Constraint`
  Direct Known Subclasses:
    `SimpleDecimalboxConstraint`, `SimpleDoubleSpinnerConstraint`, `SimpleLongboxConstraint`, `SimpleSpinnerConstraint`

      public abstract class SimpleNumberInputConstraint<T extends java.lang.Number & java.lang.Comparable<T>>
      extends SimpleConstraint

  A simple NumberInput constraint.
  Since:
    10.2.0
  Author:
    Jamson Chan
  See Also:
    Serialized Form

- - ### Field Summary

    - ### Fields inherited from class org.zkoss.zul.SimpleConstraint

      `_finishParseCst, _flags, AFTER_END, AFTER_POINTER, AFTER_START, AT_POINTER, BEFORE_END, BEFORE_START, END_AFTER, END_BEFORE, NO_EMPTY, NO_FUTURE, NO_NEGATIVE, NO_PAST, NO_POSITIVE, NO_TODAY, NO_ZERO, OVERLAP, OVERLAP_AFTER, OVERLAP_BEFORE, OVERLAP_END, SERVER, START_AFTER, START_BEFORE, STRICT`

  - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `SimpleNumberInputConstraint()` | Constructs a constraint.
    `SimpleNumberInputConstraint​(int flags)` | Constructs a constraint.
    `SimpleNumberInputConstraint​(java.lang.String constraint)` | Constructs a constraint with a list of constraints separated by comma.

  - ### Method Summary

    All Methods Instance Methods Abstract Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `T` | `getMax()` | Returns the maximum value.
    `T` | `getMin()` | Returns the minimum value.
    `protected WrongValueException` | `outOfRangeValue​(Component comp)` |
    `protected int` | `parseConstraint​(java.lang.String constraint)` | Parses a constraint into an integer value.
    `protected abstract T` | `parseValue​(java.lang.String value)` | Parse the string value to the specified number type T.
    `void` | `setMax​(T max)` | Sets the maximum value.
    `void` | `setMin​(T min)` | Sets the minimum value.
    `void` | `validate​(Component comp, java.lang.Object value)` | Verifies whether the value is acceptable.

    - ### Methods inherited from class org.zkoss.zul.SimpleConstraint

      `getClientConstraint, getClientPackages, getErrorMessage, getFlags, getInstance, getRawValue`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### SimpleNumberInputConstraint

          public SimpleNumberInputConstraint()

      Constructs a constraint.

    - #### SimpleNumberInputConstraint

          public SimpleNumberInputConstraint​(int flags)

      Constructs a constraint.
      Parameters:
        `flags` - a combination of `SimpleConstraint.NO_POSITIVE`, `SimpleConstraint.NO_NEGATIVE`, `SimpleConstraint.NO_ZERO`, and so on.

    - #### SimpleNumberInputConstraint

          public SimpleNumberInputConstraint​(java.lang.String constraint)

      Constructs a constraint with a list of constraints separated by comma.
      Parameters:
        `constraint` - a list of constraints separated by comma. Example: no positive, no zero

  - ### Method Detail

    - #### getMin

          public T getMin()

      Returns the minimum value.

    - #### setMin

          public void setMin​(T min)

      Sets the minimum value.

    - #### getMax

          public T getMax()

      Returns the maximum value.

    - #### setMax

          public void setMax​(T max)

      Sets the maximum value.

    - #### parseValue

          protected abstract T parseValue​(java.lang.String value)

      Parse the string value to the specified number type T. This method should be implemented by subclasses to convert a string representation of a number to the appropriate numeric type for this constraint.
      Parameters:
        `value` - the string representation of a number
      Returns:
        the parsed number of type T

    - #### parseConstraint

          protected int parseConstraint​(java.lang.String constraint)
                                 throws UiException

      Description copied from class: `SimpleConstraint`
      Parses a constraint into an integer value. For example, "no positive" is parsed to `SimpleConstraint.NO_POSITIVE`.

      Deriving classes might override this to provide more constraints.

      Overrides:
        `parseConstraint` in class `SimpleConstraint`
      Throws:
        `UiException`

    - #### validate

          public void validate​(Component comp,
                               java.lang.Object value)
                        throws WrongValueException

      Description copied from interface: `Constraint`
      Verifies whether the value is acceptable.
      Specified by:
        `validate` in interface `Constraint`
      Overrides:
        `validate` in class `SimpleConstraint`
      Parameters:
        `comp` - the component being validated
      Throws:
        `WrongValueException`

    - #### outOfRangeValue

          protected WrongValueException outOfRangeValue​(Component comp)