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 intmaxprotected intmin-
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 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.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.jboss.as.controller.operations.validation.ParameterValidator
validateResolvedParameter
-
-
-
-
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-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 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
-
-