org.keycloak.validate.validators

## Class IntegerValidator

- java.lang.Object
- - org.keycloak.validate.AbstractSimpleValidator
  - - org.keycloak.validate.validators.AbstractNumberValidator
    - - org.keycloak.validate.validators.IntegerValidator

- All Implemented Interfaces:
    ConfiguredProvider, Provider, ProviderFactory<Validator>, SimpleValidator, Validator, ValidatorFactory

      public class IntegerValidator
      extends AbstractNumberValidator
      implements ConfiguredProvider

  Validate input being integer number `Integer` or `Long`. Accepts String also if convertible to `Long` by common `Long.parseLong(String)` operation.
  Author:
    Vlastimil Elias

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static String` | `ID`
    `static IntegerValidator` | `INSTANCE`

    - ### Fields inherited from class org.keycloak.validate.validators.AbstractNumberValidator

      `configProperties, KEY_MAX, KEY_MIN, MESSAGE_INVALID_NUMBER, MESSAGE_NUMBER_OUT_OF_RANGE, MESSAGE_NUMBER_OUT_OF_RANGE_TOO_BIG, MESSAGE_NUMBER_OUT_OF_RANGE_TOO_SMALL`

    - ### Fields inherited from class org.keycloak.validate.AbstractSimpleValidator

      `IGNORE_EMPTY_VALUE`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `IntegerValidator()`
    `IntegerValidator(ValidatorConfig config)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected Number` | `convert(Object value, ValidatorConfig config)` Convert input value to instance of Number supported by this validator.
    `String` | `getHelpText()`
    `String` | `getId()`
    `protected Number` | `getMinMaxConfig(ValidatorConfig config, String key)` Get config value for min and max validation bound as a Number supported by this validator
    `protected boolean` | `isFirstGreaterThanToSecond(Number n1, Number n2)` Compare two numbers of supported type (fed by `AbstractNumberValidator.convert(Object, ValidatorConfig)` and `AbstractNumberValidator.getMinMaxConfig(ValidatorConfig, String)` )

    - ### Methods inherited from class org.keycloak.validate.validators.AbstractNumberValidator

      `doValidate, getConfigProperties, selectRangeErrorMessage, skipValidation, validateConfig`

    - ### Methods inherited from class org.keycloak.validate.AbstractSimpleValidator

      `isIgnoreEmptyValuesConfigured, validate`

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

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

    - ### Methods inherited from interface org.keycloak.provider.ConfiguredProvider

      `getConfigProperties`

    - ### Methods inherited from interface org.keycloak.validate.SimpleValidator

      `close, create, init, postInit`

    - ### Methods inherited from interface org.keycloak.validate.Validator

      `validate, validate, validate, validate, validate, validate`

    - ### Methods inherited from interface org.keycloak.provider.ProviderFactory

      `order`

- - ### Field Detail

    - #### ID

          public static final String ID

      See Also:
        Constant Field Values

    - #### INSTANCE

          public static final IntegerValidator INSTANCE

  - ### Constructor Detail

    - #### IntegerValidator

          public IntegerValidator()

    - #### IntegerValidator

          public IntegerValidator(ValidatorConfig config)

  - ### Method Detail

    - #### convert

          protected Number convert(Object value,
                                   ValidatorConfig config)

      Description copied from class: `AbstractNumberValidator`
      Convert input value to instance of Number supported by this validator.
      Specified by:
        `convert` in class `AbstractNumberValidator`
      Parameters:
        `value` - to convert
      Returns:
        value converted to supported Number instance

    - #### getId

          public String getId()

      Specified by:
        `getId` in interface `ProviderFactory<Validator>`

    - #### getMinMaxConfig

          protected Number getMinMaxConfig(ValidatorConfig config,
                                           String key)

      Description copied from class: `AbstractNumberValidator`
      Get config value for min and max validation bound as a Number supported by this validator
      Specified by:
        `getMinMaxConfig` in class `AbstractNumberValidator`
      Parameters:
        `config` - to get from
        `key` - of the config value
      Returns:
        bound value or null

    - #### isFirstGreaterThanToSecond

          protected boolean isFirstGreaterThanToSecond(Number n1,
                                                       Number n2)

      Description copied from class: `AbstractNumberValidator`
      Compare two numbers of supported type (fed by `AbstractNumberValidator.convert(Object, ValidatorConfig)` and `AbstractNumberValidator.getMinMaxConfig(ValidatorConfig, String)` )
      Specified by:
        `isFirstGreaterThanToSecond` in class `AbstractNumberValidator`
      Returns:
        true if first number is greater than second

    - #### getHelpText

          public String getHelpText()

      Specified by:
        `getHelpText` in interface `ConfiguredProvider`

Copyright © 2021 JBoss by Red Hat. All rights reserved.