Class EntityJsonParser
- java.lang.Object
-
- org.symphonyoss.symphony.entityjson.EntityJsonParser
-
public class EntityJsonParser extends Object
A parser for EntityJSON and StructuredObject. Obtain via EntityJsonParserBuilder.- Author:
- Bruce Skingle
-
-
Field Summary
Fields Modifier and Type Field Description static URLENTITY_JSON_EXAMPLE_URLstatic URLENTITY_JSON_SCHEMA_URLstatic URLJSON_SCHEMA_SCHEMA_URLstatic URLSTRUCTURED_OBJECT_SCHEMA_URL
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description EntityJsonparseEntityJson(Object instanceSource, com.fasterxml.jackson.databind.node.ObjectNode instance)Parse an EntityJSON instance from the given URL.EntityJsonparseEntityJson(Object instanceSource, Reader instanceReader)Parse an EntityJSON instance from the given URL.EntityJsonparseEntityJson(URL instanceUrl)Parse an EntityJSON instance from the given URL.StructuredObjectparseStructuredObject(Object instanceSource, com.fasterxml.jackson.databind.node.ObjectNode instance)Parse a single StructuredObject instance from the given URL.StructuredObjectparseStructuredObject(Object instanceSource, Reader instanceReader)Parse a single StructuredObject instance from the given URL.StructuredObjectparseStructuredObject(URL instanceUrl)Parse a single StructuredObject instance from the given URL.
-
-
-
Field Detail
-
JSON_SCHEMA_SCHEMA_URL
public static final URL JSON_SCHEMA_SCHEMA_URL
-
ENTITY_JSON_SCHEMA_URL
public static final URL ENTITY_JSON_SCHEMA_URL
-
ENTITY_JSON_EXAMPLE_URL
public static final URL ENTITY_JSON_EXAMPLE_URL
-
STRUCTURED_OBJECT_SCHEMA_URL
public static final URL STRUCTURED_OBJECT_SCHEMA_URL
-
-
Method Detail
-
parseEntityJson
public EntityJson parseEntityJson(URL instanceUrl) throws SchemaValidationException, InvalidInstanceException
Parse an EntityJSON instance from the given URL. Callers may prefer to catch EntityJSONException and treat all failures in the same way.- Parameters:
instanceUrl- A URL pointing to the JSON representation of an EntityJSON instance.- Returns:
- An EntityJSON instance.
- Throws:
SchemaValidationException- If the given instance does not meet the general EntityJSON schema.InvalidInstanceException- If the given instance is structurally invalid.
-
parseEntityJson
public EntityJson parseEntityJson(Object instanceSource, Reader instanceReader) throws SchemaValidationException, InvalidInstanceException
Parse an EntityJSON instance from the given URL. Callers may prefer to catch EntityJSONException and treat all failures in the same way.- Parameters:
instanceSource- An object describing the source of the instance, typically an instance of java.net.URL or java.io.File.instanceReader- A Reader containing the JSON representation of an EntityJSON instance.- Returns:
- An EntityJSON instance.
- Throws:
SchemaValidationException- If the given instance does not meet the general EntityJSON schema.InvalidInstanceException- If the given instance is structurally invalid.
-
parseEntityJson
public EntityJson parseEntityJson(Object instanceSource, com.fasterxml.jackson.databind.node.ObjectNode instance) throws SchemaValidationException, InvalidInstanceException
Parse an EntityJSON instance from the given URL. Callers may prefer to catch EntityJSONException and treat all failures in the same way.- Parameters:
instanceSource- An object describing the source of the instance, typically an instance of java.net.URL or java.io.File.instance- A JSON ObjectNode containing the JSON representation of an EntityJSON instance.- Returns:
- An EntityJSON instance.
- Throws:
SchemaValidationException- If the given instance does not meet the general EntityJSON schema.InvalidInstanceException- If the given instance is structurally invalid.
-
parseStructuredObject
public StructuredObject parseStructuredObject(URL instanceUrl) throws SchemaValidationException, InvalidInstanceException
Parse a single StructuredObject instance from the given URL. Callers may prefer to catch EntityJSONException and treat all failures in the same way.- Parameters:
instanceUrl- A URL pointing to the JSON representation of a StructuredObject instance.- Returns:
- A StructuredObject instance.
- Throws:
SchemaValidationException- If the given instance does not meet the general EntityJSON schema.InvalidInstanceException- If the given instance is structurally invalid.
-
parseStructuredObject
public StructuredObject parseStructuredObject(Object instanceSource, Reader instanceReader) throws SchemaValidationException, InvalidInstanceException
Parse a single StructuredObject instance from the given URL. Callers may prefer to catch EntityJSONException and treat all failures in the same way.- Parameters:
instanceSource- An object describing the source of the instance, typically an instance of java.net.URL or java.io.File.instanceReader- A Reader containing the JSON representation of a single StructuredObject instance.- Returns:
- A StructuredObject instance.
- Throws:
SchemaValidationException- If the given instance does not meet the general EntityJSON schema.InvalidInstanceException- If the given instance is structurally invalid.
-
parseStructuredObject
public StructuredObject parseStructuredObject(Object instanceSource, com.fasterxml.jackson.databind.node.ObjectNode instance) throws SchemaValidationException
Parse a single StructuredObject instance from the given URL. Callers may prefer to catch EntityJSONException and treat all failures in the same way.- Parameters:
instanceSource- An object describing the source of the instance, typically an instance of java.net.URL or java.io.File.instance- A JSON ObjectNode containing the JSON representation of a single StructuredObject instance.- Returns:
- An StructuredObject instance.
- Throws:
SchemaValidationException- If the given instance does not meet the general EntityJSON schema.InvalidInstanceException- If the given instance is structurally invalid.
-
-