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

com.fasterxml.jackson.databind.jsonschema.JsonSchema Maven / Gradle / Ivy

Go to download

Easy Redis Java client and Real-Time Data Platform. Valkey compatible. Sync/Async/RxJava3/Reactive API. Client side caching. Over 50 Redis based Java objects and services: JCache API, Apache Tomcat, Hibernate, Spring, Set, Multimap, SortedSet, Map, List, Queue, Deque, Semaphore, Lock, AtomicLong, Map Reduce, Bloom filter, Scheduler, RPC

There is a newer version: 3.40.2
Show newest version
package com.fasterxml.jackson.databind.jsonschema;

import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonValue;

import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.node.JsonNodeFactory;
import com.fasterxml.jackson.databind.node.ObjectNode;

/**
 * Container for a logical JSON Schema instance.
 * Internally schema data is stored as a JSON Tree
 * (instance of {@link JsonNode} is the root
 * of schema document)
 *
 * @author Ryan Heaton
 * @see JSON Schema
 *
 * @deprecated Since 2.2, we recommend use of external
 *   JSON Schema generator module
 */
@Deprecated
public class JsonSchema
{
    private final ObjectNode schema;

    /**
     * Main constructor for schema instances.
     *

* This is the creator constructor used by Jackson itself when * deserializing instances. It is so-called delegating creator, * meaning that its argument will be bound by Jackson before * constructor gets called. */ @JsonCreator public JsonSchema(ObjectNode schema) { this.schema = schema; } /** * Method for accessing root JSON object of the contained schema. *

* Note: this method is specified with {@link JsonValue} annotation * to represent serialization to use; same as if explicitly * serializing returned object. * * @return Root node of the schema tree */ @JsonValue public ObjectNode getSchemaNode() { return schema; } @Override public String toString() { return this.schema.toString(); } @Override public int hashCode() { return schema.hashCode(); } @Override public boolean equals(Object o) { if (o == this) return true; if (o == null) return false; if (!(o instanceof JsonSchema)) return false; JsonSchema other = (JsonSchema) o; if (schema == null) { return other.schema == null; } return schema.equals(other.schema); } /** * Get the default schema node. * * @return The default schema node. */ public static JsonNode getDefaultSchemaNode() { ObjectNode objectNode = JsonNodeFactory.instance.objectNode(); objectNode.put("type", "any"); // "required" is false by default, no need to include //objectNode.put("required", false); return objectNode; } }





© 2015 - 2024 Weber Informatics LLC | Privacy Policy