Class BytesValidator
- java.lang.Object
-
- org.jboss.as.controller.operations.validation.ModelTypeValidator
-
- org.jboss.as.controller.operations.validation.BytesValidator
-
- All Implemented Interfaces:
MinMaxValidator
,ParameterValidator
public class BytesValidator extends ModelTypeValidator implements MinMaxValidator
Validates that a parameter is a byte[] of an acceptable length.- Author:
- Brian Stansberry (c) 2011 Red Hat Inc.
-
-
Field Summary
-
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 BytesValidator(int min, int max, boolean nullable)
Creates a BytesValidator that allows potentially more than one type.BytesValidator(int min, int max, org.jboss.dmr.ModelType... otherValidTypes)
Creates a BytesValidator
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static BytesValidator
createSha1(boolean nullable)
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
-
BytesValidator
public BytesValidator(int min, int max, boolean nullable)
Creates a BytesValidator that allows potentially more than one type.- Parameters:
min
- the minimum length of the byte[]max
- the maximum length of the byte[]nullable
- whether an undefined value is allowed
-
BytesValidator
public BytesValidator(int min, int max, org.jboss.dmr.ModelType... otherValidTypes)
Creates a BytesValidator- Parameters:
min
- the minimum length of the byte[]max
- the maximum length of the byte[]otherValidTypes
- additional valid types (i.e one of those whose value can convert to a byte[].) May benull
-
-
Method Detail
-
createSha1
public static BytesValidator createSha1(boolean nullable)
-
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
-
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
-
-