Class StringLengthValidator
- java.lang.Object
-
- org.jboss.as.controller.operations.validation.ModelTypeValidator
-
- org.jboss.as.controller.operations.validation.StringLengthValidator
-
- All Implemented Interfaces:
MinMaxValidator
,ParameterValidator
- Direct Known Subclasses:
MulticastAddressValidator
,SubnetValidator
,URIValidator
public class StringLengthValidator extends ModelTypeValidator implements MinMaxValidator
Validates that the given parameter is a string of an allowed length.- Author:
- Brian Stansberry (c) 2011 Red Hat Inc.
-
-
Field Summary
Fields Modifier and Type Field Description protected int
max
protected int
min
-
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 StringLengthValidator(int min)
Equivalent tothis(min, Integer.MAX_VALUE, false, false)
.StringLengthValidator(int min, boolean nullable)
Equivalent tothis(min, Integer.MAX_VALUE, nullable, false)
.StringLengthValidator(int min, boolean nullable, boolean allowExpressions)
Equivalent tothis(min, Integer.MAX_VALUE, nullable, allowExpressions)
.StringLengthValidator(int min, int max)
StringLengthValidator(int min, int max, boolean nullable, boolean allowExpressions)
Creates a newStringLengthValidator
.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Long
getMax()
Gets the maximum, if there is one.Long
getMin()
Gets the minimum, if there is one.void
validateParameter(String parameterName, org.jboss.dmr.ModelNode value)
Validate the parameter with the given name.
-
-
-
Constructor Detail
-
StringLengthValidator
public StringLengthValidator(int min)
Equivalent tothis(min, Integer.MAX_VALUE, false, false)
.- Parameters:
min
- the minimum length of the string
-
StringLengthValidator
public StringLengthValidator(int min, int max)
-
StringLengthValidator
public StringLengthValidator(int min, boolean nullable)
Equivalent tothis(min, Integer.MAX_VALUE, nullable, false)
.- Parameters:
min
- the minimum length of the stringnullable
-true
is anModelType.UNDEFINED
value is valid
-
StringLengthValidator
public StringLengthValidator(int min, int max, boolean nullable, boolean allowExpressions)
Creates a newStringLengthValidator
.- Parameters:
min
- the minimum length of the stringmax
- the maximum length of the stringnullable
-true
if anModelType.UNDEFINED
value is validallowExpressions
-true
if anModelType.EXPRESSION
value is valid
-
StringLengthValidator
public StringLengthValidator(int min, boolean nullable, boolean allowExpressions)
Equivalent tothis(min, Integer.MAX_VALUE, nullable, allowExpressions)
.- Parameters:
min
- the minimum length of the stringnullable
-true
if anModelType.UNDEFINED
value is validallowExpressions
-true
if anModelType.EXPRESSION
value is valid
-
-
Method Detail
-
validateParameter
public void validateParameter(String parameterName, org.jboss.dmr.ModelNode value) throws OperationFailedException
Validate the parameter with the given name.- Specified by:
validateParameter
in interfaceParameterValidator
- Overrides:
validateParameter
in classModelTypeValidator
- Parameters:
parameterName
- the name of the parameter. Cannot benull
value
- the parameter value. Cannot benull
- Throws:
OperationFailedException
- if the value is not valid
-
getMin
public Long getMin()
Description copied from interface:MinMaxValidator
Gets the minimum, if there is one.- Specified by:
getMin
in interfaceMinMaxValidator
- Returns:
- the minimum value, or
null
if there is no minimum
-
getMax
public Long getMax()
Description copied from interface:MinMaxValidator
Gets the maximum, if there is one.- Specified by:
getMax
in interfaceMinMaxValidator
- Returns:
- the maximum value, or
null
if there is no minimum
-
-