All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.github.fge.jsonschema.tree.SchemaTree Maven / Gradle / Ivy

There is a newer version: 2.2.6
Show newest version
/*
 * Copyright (c) 2013, Francis Galiegue 
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the Lesser GNU General Public License as
 * published by the Free Software Foundation, either version 3 of the
 * License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * Lesser GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see .
 */

package com.github.fge.jsonschema.tree;

import com.github.fge.jsonschema.ref.JsonPointer;
import com.github.fge.jsonschema.ref.JsonRef;

public interface SchemaTree
    extends SimpleTree
{
    /**
     * Relocate the tree relatively to the current tree's pointer
     *
     * @param pointer the pointer to append
     * @return a new tree
     * @see JsonPointer#append(JsonPointer)
     */
    SchemaTree append(final JsonPointer pointer);

    /**
     * Relocate the tree with an absolute pointer
     *
     * @param pointer the pointer
     * @return a new tree
     */
    SchemaTree setPointer(final JsonPointer pointer);

    /**
     * Resolve a JSON Reference against the current resolution context
     *
     * @param other the JSON Reference to resolve
     * @return the resolved reference
     * @see JsonRef#resolve(JsonRef)
     */
    JsonRef resolve(final JsonRef other);

    /**
     * Tell whether a JSON Reference is contained within this schema tree
     *
     * 

This method will return {@code true} if the caller can attempt * to retrieve the JSON value addressed by this reference from the schema * tree directly.

* *

Note that the reference must be fully resolved for this method * to work.

* * @param ref the target reference * @return see description * @see #resolve(JsonRef) */ boolean containsRef(final JsonRef ref); /** * Return a matching pointer in this tree for a fully resolved reference * *

This must be called only when {@link #containsRef(JsonRef)} * returns {@code true}. Otherwise, its result is undefined.

* * @param ref the reference * @return the matching pointer, or {@code null} if not found */ JsonPointer matchingPointer(final JsonRef ref); /** * Get the loading URI for that schema * * @return the loading URI as a {@link JsonRef} */ JsonRef getLoadingRef(); /** * Get the current resolution context * * @return the context as a {@link JsonRef} */ JsonRef getContext(); /** * Tell whether this schema has been deemed valid by the syntax processor * * @return true if the schema is valid */ boolean isValid(); /** * Return a new schema tree with a new validation status * * @param valid the new validation status * @return a new tree */ SchemaTree withValidationStatus(final boolean valid); }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy