Class MetaschemaJsonReader
java.lang.Object
gov.nist.secauto.metaschema.databind.io.json.MetaschemaJsonReader
- All Implemented Interfaces:
IParsingContext<com.fasterxml.jackson.core.JsonParser,
,IJsonProblemHandler> IJsonParsingContext
,IItemReadHandler
-
Nested Class Summary
Nested classes/interfaces inherited from interface gov.nist.secauto.metaschema.databind.io.json.IJsonParsingContext
IJsonParsingContext.IInstanceReader
-
Constructor Summary
ConstructorDescriptionMetaschemaJsonReader
(com.fasterxml.jackson.core.JsonParser parser) Construct a new Module-aware JSON parser using the default problem handler.MetaschemaJsonReader
(com.fasterxml.jackson.core.JsonParser parser, IJsonProblemHandler problemHandler) Construct a new Module-aware JSON parser. -
Method Summary
Modifier and TypeMethodDescriptionprotected com.fasterxml.jackson.databind.ObjectMapper
A handler that provides callbacks used to resolve parsing issues.com.fasterxml.jackson.core.JsonParser
The parser used for reading data associated with the supported format.final com.fasterxml.jackson.core.JsonParser
pop
(com.fasterxml.jackson.core.JsonParser parser) final void
push
(com.fasterxml.jackson.core.JsonParser parser) readChoiceGroupItem
(IBoundObject parentItem, IBoundInstanceModelChoiceGroup instance) Parse and return an item.readItemAssembly
(IBoundObject parentItem, IBoundDefinitionModelAssembly definition) Parse and return an item.readItemAssembly
(IBoundObject parentItem, IBoundInstanceModelAssembly instance) Parse and return an item.readItemAssembly
(IBoundObject parentItem, IBoundInstanceModelGroupedAssembly instance) Parse and return an item.readItemField
(IBoundObject parentItem, IBoundDefinitionModelFieldComplex definition) Parse and return an item.readItemField
(IBoundObject parentItem, IBoundInstanceModelFieldComplex instance) Parse and return an item.readItemField
(IBoundObject parentItem, IBoundInstanceModelFieldScalar instance) Parse and return an item.readItemField
(IBoundObject parentItem, IBoundInstanceModelGroupedField instance) Parse and return an item.readItemFieldValue
(IBoundObject parentItem, IBoundFieldValue fieldValue) Parse and return an item.readItemFlag
(IBoundObject parentItem, IBoundInstanceFlag instance) Parse and return an item.<T> T
readObject
(IBoundDefinitionModelComplex definition) <T> T
readObjectRoot
(IBoundDefinitionModelComplex definition, String expectedFieldName)
-
Constructor Details
-
MetaschemaJsonReader
public MetaschemaJsonReader(@NonNull com.fasterxml.jackson.core.JsonParser parser) throws IOException Construct a new Module-aware JSON parser using the default problem handler.- Parameters:
parser
- the JSON parser to parse with- Throws:
IOException
- if an error occurred while reading the JSON- See Also:
-
MetaschemaJsonReader
public MetaschemaJsonReader(@NonNull com.fasterxml.jackson.core.JsonParser parser, @NonNull IJsonProblemHandler problemHandler) throws IOException Construct a new Module-aware JSON parser.- Parameters:
parser
- the JSON parser to parse withproblemHandler
- the problem handler implementation to use- Throws:
IOException
- if an error occurred while reading the JSON
-
-
Method Details
-
getReader
Description copied from interface:IParsingContext
The parser used for reading data associated with the supported format.- Specified by:
getReader
in interfaceIParsingContext<com.fasterxml.jackson.core.JsonParser,
IJsonProblemHandler> - Returns:
- the parser
-
push
- Throws:
IOException
-
pop
@NonNull public final com.fasterxml.jackson.core.JsonParser pop(@NonNull com.fasterxml.jackson.core.JsonParser parser) -
getProblemHandler
Description copied from interface:IParsingContext
A handler that provides callbacks used to resolve parsing issues.- Specified by:
getProblemHandler
in interfaceIParsingContext<com.fasterxml.jackson.core.JsonParser,
IJsonProblemHandler> - Returns:
- the configured handler
-
getObjectMapper
-
readObject
@NonNull public <T> T readObject(@NonNull IBoundDefinitionModelComplex definition) throws IOException - Throws:
IOException
-
readObjectRoot
@NonNull public <T> T readObjectRoot(@NonNull IBoundDefinitionModelComplex definition, @NonNull String expectedFieldName) throws IOException - Throws:
IOException
-
readItemFlag
Description copied from interface:IItemReadHandler
Parse and return an item.- Specified by:
readItemFlag
in interfaceIItemReadHandler
- Parameters:
parentItem
- the parent Java object to use for serialization callbacksinstance
- the flag instance- Returns:
- the Java object representing the parsed item
- Throws:
IOException
- if an error occurred while parsing
-
readItemField
public Object readItemField(IBoundObject parentItem, IBoundInstanceModelFieldScalar instance) throws IOException Description copied from interface:IItemReadHandler
Parse and return an item.- Specified by:
readItemField
in interfaceIItemReadHandler
- Parameters:
parentItem
- the parent Java object to use for serialization callbacksinstance
- the field instance- Returns:
- the Java object representing the parsed item
- Throws:
IOException
- if an error occurred while parsing
-
readItemField
public IBoundObject readItemField(IBoundObject parentItem, IBoundInstanceModelFieldComplex instance) throws IOException Description copied from interface:IItemReadHandler
Parse and return an item.- Specified by:
readItemField
in interfaceIItemReadHandler
- Parameters:
parentItem
- the parent Java object to use for serialization callbacksinstance
- the field instance- Returns:
- the Java object representing the parsed item
- Throws:
IOException
- if an error occurred while parsing
-
readItemField
public IBoundObject readItemField(IBoundObject parentItem, IBoundInstanceModelGroupedField instance) throws IOException Description copied from interface:IItemReadHandler
Parse and return an item.- Specified by:
readItemField
in interfaceIItemReadHandler
- Parameters:
parentItem
- the parent Java object to use for serialization callbacksinstance
- the field instance- Returns:
- the Java object representing the parsed item
- Throws:
IOException
- if an error occurred while parsing
-
readItemField
public IBoundObject readItemField(IBoundObject parentItem, IBoundDefinitionModelFieldComplex definition) throws IOException Description copied from interface:IItemReadHandler
Parse and return an item.- Specified by:
readItemField
in interfaceIItemReadHandler
- Parameters:
parentItem
- the parent Java object to use for serialization callbacks, ornull
if there is no parentdefinition
- the field instance- Returns:
- the Java object representing the parsed item
- Throws:
IOException
- if an error occurred while parsing
-
readItemFieldValue
public Object readItemFieldValue(IBoundObject parentItem, IBoundFieldValue fieldValue) throws IOException Description copied from interface:IItemReadHandler
Parse and return an item.- Specified by:
readItemFieldValue
in interfaceIItemReadHandler
- Parameters:
parentItem
- the parent Java object to use for serialization callbacksfieldValue
- the field value instance- Returns:
- the Java object representing the parsed item
- Throws:
IOException
- if an error occurred while parsing
-
readItemAssembly
public IBoundObject readItemAssembly(IBoundObject parentItem, IBoundInstanceModelAssembly instance) throws IOException Description copied from interface:IItemReadHandler
Parse and return an item.- Specified by:
readItemAssembly
in interfaceIItemReadHandler
- Parameters:
parentItem
- the parent Java object to use for serialization callbacksinstance
- the assembly instance- Returns:
- the Java object representing the parsed item
- Throws:
IOException
- if an error occurred while parsing
-
readItemAssembly
public IBoundObject readItemAssembly(IBoundObject parentItem, IBoundInstanceModelGroupedAssembly instance) throws IOException Description copied from interface:IItemReadHandler
Parse and return an item.- Specified by:
readItemAssembly
in interfaceIItemReadHandler
- Parameters:
parentItem
- the parent Java object to use for serialization callbacksinstance
- the assembly instance- Returns:
- the Java object representing the parsed item
- Throws:
IOException
- if an error occurred while parsing
-
readItemAssembly
public IBoundObject readItemAssembly(IBoundObject parentItem, IBoundDefinitionModelAssembly definition) throws IOException Description copied from interface:IItemReadHandler
Parse and return an item.- Specified by:
readItemAssembly
in interfaceIItemReadHandler
- Parameters:
parentItem
- the parent Java object to use for serialization callbacks, ornull
if there is no parentdefinition
- the assembly instance- Returns:
- the Java object representing the parsed item
- Throws:
IOException
- if an error occurred while parsing
-
readChoiceGroupItem
public IBoundObject readChoiceGroupItem(IBoundObject parentItem, IBoundInstanceModelChoiceGroup instance) throws IOException Description copied from interface:IItemReadHandler
Parse and return an item.- Specified by:
readChoiceGroupItem
in interfaceIItemReadHandler
- Parameters:
parentItem
- the parent Java object to use for serialization callbacksinstance
- the choice group instance- Returns:
- the Java object representing the parsed item
- Throws:
IOException
- if an error occurred while parsing
-