Class Validator

    • Field Detail

      • required

        protected boolean required
        Whether the schema represented by this validator is required.
    • Constructor Detail

      • Validator

        public Validator​(Map<String,​Object> schema,
                         List<String> jsonPointer)
        Default ctor.
        Parameters:
        schema - the schema holding the reference to this validator
        jsonPointer - the JSON pointer locating where this validator was defined in the schema.
    • 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
      • newList

        protected List<String> newList​(List<String> list,
                                       String... newElems)
        Returns a new List with the additional elements appended at the end.
        Parameters:
        list - the list to copy
        newElems - the new elements to append
        Returns:
        a new List with 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 aggregated
        col - 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 aggregated
        map - the sub-validators for which to collect other sub-validators