Interface JsonNodeValidator<T extends JsonNode>
- Type Parameters:
T
- the type of theJsonNode
- All Superinterfaces:
ObjectComponent<JsonNodeValidator<T>,
,T> ValidatorComponent<JsonNodeValidator<T>,
T>
public interface JsonNodeValidator<T extends JsonNode>
extends ValidatorComponent<JsonNodeValidator<T>,T>, ObjectComponent<JsonNodeValidator<T>,T>
Validates the state of a JsonNode.
-
Method Summary
Modifier and TypeMethodDescriptionisArray()
Ensures that the node contains an array.Ensures that the node contains aBigDecimal
.Ensures that the node contains aBigInteger
.Ensures that the node contains a Boolean.Ensures that the node contains an array or object.Ensures that the node contains afloat
ordouble
.Ensures that the node contains abyte
,short
,int
orlong
.Ensures that the value references a missing node.isNumber()
Ensures that the node contains aNumber
.isObject()
Ensures that the node contains an object.isString()
Ensures that the node contains a String.isValue()
Ensures that the node contains a binary value, boolean, null, number or string.Returns a validator for the node's property.size()
Returns a validator over the node'ssize
.Methods declared in interface com.github.cowwoc.requirements10.java.validator.component.ObjectComponent
getValue, isEqualTo, isEqualTo, isInstanceOf, isInstanceOf, isNotEqualTo, isNotEqualTo, isNotInstanceOf, isNotInstanceOf, isNotNull, isNull, isReferenceEqualTo, isReferenceNotEqualTo
Methods declared in interface com.github.cowwoc.requirements10.java.validator.component.ValidatorComponent
and, elseGetFailures, elseThrow, getContext, getContextAsString, getName, getValueOrDefault, validationFailed, withContext
-
Method Details
-
property
Returns a validator for the node's property.- Parameters:
name
- the name of a property- Returns:
- a validator for the property
- Throws:
NullPointerException
- if the value orname
are nullIllegalArgumentException
- if the node does not contain the property
-
size
Returns a validator over the node'ssize
.- Returns:
- a validator over the node's
size
- Throws:
NullPointerException
- if the value is null
-
isNumber
JsonNodeValidator<NumericNode> isNumber()Ensures that the node contains aNumber
.- Returns:
- this
- Throws:
NullPointerException
- if the value is nullIllegalArgumentException
- if the node does not contain a number
-
isIntegralNumber
JsonNodeValidator<NumericNode> isIntegralNumber()Ensures that the node contains abyte
,short
,int
orlong
.- Returns:
- this
- Throws:
NullPointerException
- if the value is nullIllegalArgumentException
- if the node does not contain an integral number
-
isFloatingPointNumber
JsonNodeValidator<NumericNode> isFloatingPointNumber()Ensures that the node contains afloat
ordouble
.- Returns:
- this
- Throws:
NullPointerException
- if the value is nullIllegalArgumentException
- if the node does not contain a decimal number
-
isBigInteger
JsonNodeValidator<BigIntegerNode> isBigInteger()Ensures that the node contains aBigInteger
.- Returns:
- this
- Throws:
NullPointerException
- if the value is nullIllegalArgumentException
- if the node does not contain aBigInteger
-
isBigDecimal
JsonNodeValidator<DecimalNode> isBigDecimal()Ensures that the node contains aBigDecimal
.- Returns:
- this
- Throws:
NullPointerException
- if the value is nullIllegalArgumentException
- if the node does not contain aBigDecimal
-
isMissing
JsonNodeValidator<MissingNode> isMissing()Ensures that the value references a missing node.- Returns:
- this
- Throws:
NullPointerException
- if the value is nullIllegalArgumentException
- if the value does not represent a missing node- See Also:
-
isValue
JsonNodeValidator<ValueNode> isValue()Ensures that the node contains a binary value, boolean, null, number or string.- Returns:
- this
- Throws:
NullPointerException
- if the value is nullIllegalArgumentException
- if the value is not a binary value, boolean, null, number or string- See Also:
-
isContainer
JsonNodeValidator<ContainerNode<?>> isContainer()Ensures that the node contains an array or object.- Returns:
- this
- Throws:
NullPointerException
- if the value is nullIllegalArgumentException
- if the value is a "missing" or a value node- See Also:
-
isArray
JsonNodeValidator<ArrayNode> isArray()Ensures that the node contains an array.- Returns:
- this
- Throws:
NullPointerException
- if the value is nullIllegalArgumentException
- if the value is not an array- See Also:
-
isObject
JsonNodeValidator<ObjectNode> isObject()Ensures that the node contains an object.- Returns:
- this
- Throws:
NullPointerException
- if the value is nullIllegalArgumentException
- if the value is not an object- See Also:
-
isString
JsonNodeValidator<TextNode> isString()Ensures that the node contains a String.- Returns:
- this
- Throws:
NullPointerException
- if the value is nullIllegalArgumentException
- if the value is not a String- See Also:
-
isBoolean
JsonNodeValidator<BooleanNode> isBoolean()Ensures that the node contains a Boolean.- Returns:
- this
- Throws:
NullPointerException
- if the value is nullIllegalArgumentException
- if the value is not a Boolean- See Also:
-