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
public abstract class Validator extends Object implements SimpleValidator<Object>
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
Fields Modifier and Type Field Description protected booleanrequiredWhether the schema represented by this validator is required.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidcollectAllValidators(Collection<Validator> results)Collects all the sub-validators held in this validator and aggregates them in the passed in Collection.protected static voidcollectAllValidators(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 voidcollectAllValidators(Collection<Validator> results, Map<?,? extends Validator> map)Collects all the sub-validators held in this validator and aggregates them in the passed in Collection.JsonPointergetJsonPointer()Returns the JSON pointer locating where the validator was defined in the schema.protected JsonPointergetPath(JsonPointer at, String property)Gets the valid JSONPath of the node or the given property.booleanisRequired()Returns whether the schema represented by this validator is required.protected List<String>newList(List<String> list, String... newElems)Returns a newListwith the additional elements appended at the end.voidresolveSchemaReferences()Resolves schema references for this validator.StringtoString()-
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
-
-
-
-
Method Detail
-
getPath
protected final JsonPointer getPath(JsonPointer at, String property)
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
protected List<String> newList(List<String> list, String... newElems)
Returns a newListwith the additional elements appended at the end.- Parameters:
list- the list to copynewElems- the new elements to append- Returns:
- a new
Listwith the additional elements appended at the end.
-
getJsonPointer
public JsonPointer 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:
Constants.REF
-
collectAllValidators
protected void collectAllValidators(Collection<Validator> results)
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
-
-