xpertss.json.schema.keyword.digest.helpers.SimpleDigester Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of json-schema Show documentation
Show all versions of json-schema Show documentation
A Java implementation of the JSON Schema specification.
The newest version!
package xpertss.json.schema.keyword.digest.helpers;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.node.ObjectNode;
import com.github.fge.jackson.NodeType;
import xpertss.json.schema.keyword.digest.AbstractDigester;
/**
* A digester only returning the node associated with the keyword
*
* As with all digesters, however, you are required to specify what types
* this keyword supports.
*/
public final class SimpleDigester extends AbstractDigester {
public SimpleDigester(String keyword, NodeType first, NodeType... other)
{
super(keyword, first, other);
}
@Override
public JsonNode digest(JsonNode schema)
{
ObjectNode ret = FACTORY.objectNode();
ret.put(keyword, schema.get(keyword));
return ret;
}
}