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
Validates that the given parameter is a string of an allowed length.
- Author:
- Brian Stansberry (c) 2011 Red Hat Inc.
-
Field Summary
FieldsFields inherited from class org.jboss.as.controller.operations.validation.ModelTypeValidator
BIGDECIMAL_MAX, BIGDECIMAL_MIN, BIGINTEGER_MAX, BIGINTEGER_MIN, nullable, strictType, validTypes -
Constructor Summary
ConstructorsConstructorDescriptionStringLengthValidator(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
-
Field Details
-
min
protected final int min -
max
protected final int max
-
-
Constructor Details
-
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-trueis anModelType.UNDEFINEDvalue 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-trueif anModelType.UNDEFINEDvalue is validallowExpressions-trueif anModelType.EXPRESSIONvalue 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-trueif anModelType.UNDEFINEDvalue is validallowExpressions-trueif anModelType.EXPRESSIONvalue is valid
-
-
Method Details
-
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
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
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
-