public class NillableOrExpressionParameterValidator extends Object implements ParameterValidator, MinMaxValidator, AllowedValuesValidator
ParameterValidator
that validates undefined values and expression types, delegating to a provided
validator for everything else.Constructor and Description |
---|
NillableOrExpressionParameterValidator(ParameterValidator delegate,
Boolean allowNull,
boolean allowExpression)
Creates a new
NillableOrExpressionParameterValidator . |
Modifier and Type | Method and Description |
---|---|
List<org.jboss.dmr.ModelNode> |
getAllowedValues()
Gets the allowed values, or
null if any value is allowed. |
Boolean |
getAllowNull() |
ParameterValidator |
getDelegate() |
Long |
getMax()
Gets the maximum, if there is one.
|
Long |
getMin()
Gets the minimum, if there is one.
|
boolean |
isAllowExpression() |
void |
validateParameter(String parameterName,
org.jboss.dmr.ModelNode value)
Validate the parameter with the given name.
|
void |
validateResolvedParameter(String parameterName,
org.jboss.dmr.ModelNode value)
Validate the parameter with the given name, after first
resolving the given value . |
public NillableOrExpressionParameterValidator(ParameterValidator delegate, Boolean allowNull, boolean allowExpression)
NillableOrExpressionParameterValidator
.delegate
- validator to delegate to once null and expression validation is done. Cannot be null
allowNull
- whether undefined values are allowed. If this param is null
, checking for undefined
is delegated to the provided delegate
allowExpression
- whether expressions are allowedIllegalArgumentException
- if delegate
is null
public void validateParameter(String parameterName, org.jboss.dmr.ModelNode value) throws OperationFailedException
ParameterValidator
validateParameter
in interface ParameterValidator
parameterName
- the name of the parameter. Cannot be null
value
- the parameter value. Cannot be null
OperationFailedException
- if the value is not validpublic void validateResolvedParameter(String parameterName, org.jboss.dmr.ModelNode value) throws OperationFailedException
ParameterValidator
resolving
the given value
.validateResolvedParameter
in interface ParameterValidator
parameterName
- the name of the parameter. Cannot be null
value
- the parameter value. Cannot be null
OperationFailedException
- if the value is not validpublic Long getMin()
MinMaxValidator
getMin
in interface MinMaxValidator
null
if there is no minimumpublic Long getMax()
MinMaxValidator
getMax
in interface MinMaxValidator
null
if there is no minimumpublic ParameterValidator getDelegate()
public Boolean getAllowNull()
public boolean isAllowExpression()
public List<org.jboss.dmr.ModelNode> getAllowedValues()
AllowedValuesValidator
null
if any value is allowed.getAllowedValues
in interface AllowedValuesValidator
null
Copyright © 2023 JBoss by Red Hat. All rights reserved.