Class StructuredObject
- java.lang.Object
-
- org.symphonyoss.symphony.entityjson.StructuredObject
-
public class StructuredObject extends Object
Represents a single Structured Object. Note that there are multiple levels of validation for EntityJSON. There is a generic Structured Object schema which all Structured Objects must conform to. There is an EntityJSON schema which describes a single JSON object where each element is a Structured Object. This is the object which is submitted with a single message and is simply a collection of named objects which the message may refer to. There are individual schemas for specific Structured Object types, but there is no requirement for such a schema to exist. Message originators are allowed to emit messages containing objects which conform only to the generic Structured Object schema which, aside from the mandatory fields of all Structured objects (type ID and type version) and the constraint that if an id attribute is present that it must be an array of (idType, idValue) tuples, may contain any valid JSON.- Author:
- Bruce Skingle
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description IEntityJsonInstanceContextgetContext()Return the parse context from which this object was created, which includes error reports if the input was invalid in some way.List<StructuredObjectId>getIdList()intgetMajorVersion()intgetMinorVersion()StringgetType()StringgetVersion()StringtoString()IEntityJsonSchemaContextvalidate(EntityJsonParser parser)Validate this object against the specific schema for this type from the official repo.
-
-
-
Method Detail
-
getContext
public IEntityJsonInstanceContext getContext()
Return the parse context from which this object was created, which includes error reports if the input was invalid in some way.- Returns:
- The parse context from which this object was created.
-
validate
public IEntityJsonSchemaContext validate(EntityJsonParser parser) throws SchemaValidationException, NoSchemaException, InvalidSchemaException
Validate this object against the specific schema for this type from the official repo.- Parameters:
parser- A parser to do the validation.- Returns:
- A context containing the detailed error report if any.
- Throws:
SchemaValidationException- If this object is not valid according to it's schema.NoSchemaException- If there is no official schema for this type.InvalidSchemaException- If the schema exists but is not itself valid or cannot be read.
-
getType
public String getType()
- Returns:
- The type of this object.
-
getVersion
public String getVersion()
- Returns:
- The Type Version of this object, guaranteed to be a string of the form [0-9]+.[0-9]+
-
getMajorVersion
public int getMajorVersion()
- Returns:
- The first (major) element of the type version.
-
getMinorVersion
public int getMinorVersion()
- Returns:
- The second (minor) element of the type version.
-
getIdList
public List<StructuredObjectId> getIdList()
- Returns:
- The immutable list of ID objects for this object.
-
-