Class Validator
java.lang.Object
org.forgerock.json.schema.validator.validators.Validator
- All Implemented Interfaces:
SimpleValidator<Object>
- Direct Known Subclasses:
AnyTypeValidator
,ArrayTypeValidator
,BooleanTypeValidator
,IntegerTypeValidator
,NullTypeValidator
,NumberTypeValidator
,ObjectTypeValidator
,ReferenceTypeValidator
,StringTypeValidator
,UnionTypeValidator
Validator is the abstract base class of all typed validator.
Each validator that responsible validate one certain type of object MUST extend this class.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected boolean
Whether the schema represented by this validator is required. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected void
collectAllValidators
(Collection<Validator> results) Collects all the sub-validators held in this validator and aggregates them in the passed in Collection.protected static void
collectAllValidators
(Collection<Validator> results, Collection<? extends Validator> col) Collects all the sub-validators held in this validator and aggregates them in the passed in Collection.protected static void
collectAllValidators
(Collection<Validator> results, Map<?, ? extends Validator> map) Collects all the sub-validators held in this validator and aggregates them in the passed in Collection.Returns the JSON pointer locating where the validator was defined in the schema.protected final JsonPointer
getPath
(JsonPointer at, String property) Gets the valid JSONPath of the node or the given property.boolean
Returns whether the schema represented by this validator is required.Returns a newList
with the additional elements appended at the end.void
Resolves schema references for this validator.toString()
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.forgerock.json.schema.validator.validators.SimpleValidator
validate
-
Field Details
-
required
protected boolean requiredWhether the schema represented by this validator is required.
-
-
Constructor Details
-
Validator
Default ctor.- Parameters:
schema
- the schema holding the reference to this validatorjsonPointer
- the JSON pointer locating where this validator was defined in the schema.
-
-
Method Details
-
getPath
Gets the valid JSONPath of the node or the given property.Combines the two parameter and generates a valid JSONPath with dot–notation.
- Simple type:
$
- Array type:
$[0]
- Object type:
$.store.book[0].title
- Parameters:
at
- JSONPath of the current node. If it's null then the value is/
property
- Property name of the child node.- Returns:
- JSONPath expressions uses the dot–notation Example: $.store.book[0].title
- Simple type:
-
newList
Returns a newList
with the additional elements appended at the end.- Parameters:
list
- the list to copynewElems
- the new elements to append- Returns:
- a new
List
with the additional elements appended at the end.
-
getJsonPointer
Returns the JSON pointer locating where the validator was defined in the schema.- Returns:
- the pointer
-
isRequired
public boolean isRequired()Returns whether the schema represented by this validator is required.- Returns:
- true if the schema represented by this validator is required, false otherwise
-
resolveSchemaReferences
public void resolveSchemaReferences()Resolves schema references for this validator.- See Also:
-
collectAllValidators
Collects all the sub-validators held in this validator and aggregates them in the passed in Collection.- Parameters:
results
- where collected validators are aggregated
-
collectAllValidators
protected static void collectAllValidators(Collection<Validator> results, Collection<? extends Validator> col) Collects all the sub-validators held in this validator and aggregates them in the passed in Collection.- Parameters:
results
- where collected validators are aggregatedcol
- the sub-validators for which to collect other sub-validators
-
collectAllValidators
protected static void collectAllValidators(Collection<Validator> results, Map<?, ? extends Validator> map) Collects all the sub-validators held in this validator and aggregates them in the passed in Collection.- Parameters:
results
- where collected validators are aggregatedmap
- the sub-validators for which to collect other sub-validators
-
toString
-