Class IntRangeValidator
- java.lang.Object
-
- org.jboss.as.controller.operations.validation.ModelTypeValidator
-
- org.jboss.as.controller.operations.validation.IntRangeValidator
-
- All Implemented Interfaces:
MinMaxValidator,ParameterValidator
public class IntRangeValidator extends ModelTypeValidator implements MinMaxValidator
Validates that the given parameter is an int in a given range.- Author:
- Brian Stansberry (c) 2011 Red Hat Inc.
-
-
Field Summary
Fields Modifier and Type Field Description protected intmaxprotected intminstatic ParameterValidatorNON_NEGATIVEValidates that a parameter is an integer greater than or equal to zero.static ParameterValidatorPOSITIVEValidates that a parameter is an integer greater than zero.-
Fields inherited from class org.jboss.as.controller.operations.validation.ModelTypeValidator
BIGDECIMAL_MAX, BIGDECIMAL_MIN, BIGINTEGER_MAX, BIGINTEGER_MIN, nullable, strictType, validTypes
-
-
Constructor Summary
Constructors Constructor Description IntRangeValidator(int min)IntRangeValidator(int min, boolean nullable)IntRangeValidator(int min, boolean nullable, boolean allowExpressions)IntRangeValidator(int min, int max)IntRangeValidator(int min, int max, boolean nullable, boolean allowExpressions)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description LonggetMax()Gets the maximum, if there is one.LonggetMin()Gets the minimum, if there is one.voidvalidateParameter(String parameterName, org.jboss.dmr.ModelNode value)Validate the parameter with the given name.
-
-
-
Field Detail
-
NON_NEGATIVE
public static final ParameterValidator NON_NEGATIVE
Validates that a parameter is an integer greater than or equal to zero.
-
POSITIVE
public static final ParameterValidator POSITIVE
Validates that a parameter is an integer greater than zero.
-
min
protected final int min
-
max
protected final int max
-
-
Constructor Detail
-
IntRangeValidator
public IntRangeValidator(int min)
-
IntRangeValidator
public IntRangeValidator(int min, int max)
-
IntRangeValidator
public IntRangeValidator(int min, boolean nullable)
-
IntRangeValidator
public IntRangeValidator(int min, boolean nullable, boolean allowExpressions)
-
IntRangeValidator
public IntRangeValidator(int min, int max, boolean nullable, boolean allowExpressions)
-
-
Method Detail
-
validateParameter
public void validateParameter(String parameterName, org.jboss.dmr.ModelNode value) throws OperationFailedException
Validate the parameter with the given name.- Specified by:
validateParameterin interfaceParameterValidator- Overrides:
validateParameterin classModelTypeValidator- Parameters:
parameterName- the name of the parameter. Cannot benullvalue- the parameter value. Cannot benull- Throws:
OperationFailedException- if the value is not valid
-
getMin
public Long getMin()
Description copied from interface:MinMaxValidatorGets the minimum, if there is one.- Specified by:
getMinin interfaceMinMaxValidator- Returns:
- the minimum value, or
nullif there is no minimum
-
getMax
public Long getMax()
Description copied from interface:MinMaxValidatorGets the maximum, if there is one.- Specified by:
getMaxin interfaceMinMaxValidator- Returns:
- the maximum value, or
nullif there is no minimum
-
-