Package org.keycloak.validate.validators
Class DoubleValidator
java.lang.Object
org.keycloak.validate.AbstractSimpleValidator
org.keycloak.validate.validators.AbstractNumberValidator
org.keycloak.validate.validators.DoubleValidator
- All Implemented Interfaces:
ConfiguredProvider
,Provider
,ProviderFactory<Validator>
,SimpleValidator
,Validator
,ValidatorFactory
Validate input being any kind of
Number
. Accepts String also if convertible to Double
by common
Double.parseDouble(String)
. Min and Max validation is based on Double
precision also.- Author:
- Vlastimil Elias <velias@redhat.com>
-
Field Summary
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
-
Method Summary
Modifier and TypeMethodDescriptionprotected Number
convert
(Object value, ValidatorConfig config) Convert input value to instance of Number supported by this validator.getId()
protected Number
getMinMaxConfig
(ValidatorConfig config, String key) Get config value for min and max validation bound as a Number supported by this validatorprotected boolean
isFirstGreaterThanToSecond
(Number n1, Number n2) Compare two numbers of supported type (fed byAbstractNumberValidator.convert(Object, ValidatorConfig)
andAbstractNumberValidator.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
getConfig, getConfigProperties
Methods inherited from interface org.keycloak.provider.ProviderFactory
dependsOn, getConfigMetadata, order
Methods inherited from interface org.keycloak.validate.SimpleValidator
close, create, init, postInit
-
Field Details
-
ID
- See Also:
-
INSTANCE
-
-
Constructor Details
-
DoubleValidator
public DoubleValidator() -
DoubleValidator
-
-
Method Details
-
getId
- Specified by:
getId
in interfaceProviderFactory<Validator>
-
convert
Description copied from class:AbstractNumberValidator
Convert input value to instance of Number supported by this validator.- Specified by:
convert
in classAbstractNumberValidator
- Parameters:
value
- to convert- Returns:
- value converted to supported Number instance
-
getMinMaxConfig
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 classAbstractNumberValidator
- Parameters:
config
- to get fromkey
- of the config value- Returns:
- bound value or null
-
isFirstGreaterThanToSecond
Description copied from class:AbstractNumberValidator
Compare two numbers of supported type (fed byAbstractNumberValidator.convert(Object, ValidatorConfig)
andAbstractNumberValidator.getMinMaxConfig(ValidatorConfig, String)
)- Specified by:
isFirstGreaterThanToSecond
in classAbstractNumberValidator
- Returns:
- true if first number is greater than second
-
getHelpText
- Specified by:
getHelpText
in interfaceConfiguredProvider
-