Module dev.metaschema.databind
Package dev.metaschema.databind.io
Interface IDeserializer<CLASS extends dev.metaschema.core.model.IBoundObject>
- Type Parameters:
CLASS- the Java type into which data can be read
- All Superinterfaces:
dev.metaschema.core.configuration.IConfiguration<DeserializationFeature<?>>,dev.metaschema.core.configuration.IMutableConfiguration<DeserializationFeature<?>>
- All Known Implementing Classes:
AbstractDeserializer,DefaultJsonDeserializer,DefaultXmlDeserializer,DefaultYamlDeserializer
public interface IDeserializer<CLASS extends dev.metaschema.core.model.IBoundObject>
extends dev.metaschema.core.configuration.IMutableConfiguration<DeserializationFeature<?>>
Implementations of this interface are able to read structured data into a
bound object instance of the parameterized type.
-
Method Summary
Modifier and TypeMethodDescriptionapplyConfiguration(dev.metaschema.core.configuration.IConfiguration<DeserializationFeature<?>> other) default CLASSdeserialize(File file) Read data from theFileinto a bound class instance.default CLASSdeserialize(InputStream is, URI documentUri) Read data from theInputStreaminto a bound class instance.default CLASSdeserialize(Reader reader, URI documentUri) Read data from theReaderinto a bound class instance.default CLASSdeserialize(URL url) Read data from the remote resource into a bound class instance.default CLASSdeserialize(Path path) Read data from thePathinto a bound class instance.default dev.metaschema.core.metapath.item.node.INodeItemdeserializeToNodeItem(InputStream is, URI documentUri) Read data from theReaderinto a node item instance.dev.metaschema.core.metapath.item.node.INodeItemdeserializeToNodeItem(Reader reader, URI documentUri) Read data from theReaderinto a node item instance.deserializeToValue(Reader reader, URI documentUri) Read data from theReaderinto a node item instance.disableFeature(DeserializationFeature<?> feature) enableFeature(DeserializationFeature<?> feature) dev.metaschema.core.model.constraint.IConstraintValidationHandlerGet the constraint validation handler configured for this deserializer, which will be used to validate loaded data.default booleanDetermine if the serializer is performing validation.set(DeserializationFeature<?> feature, Object value) voidsetConstraintValidationHandler(dev.metaschema.core.model.constraint.IConstraintValidationHandler handler) Set the constraint violation handler for constraint validation.Methods inherited from interface dev.metaschema.core.configuration.IConfiguration
get, getFeatureValues, isFeatureEnabled
-
Method Details
-
enableFeature
- Specified by:
enableFeaturein interfacedev.metaschema.core.configuration.IMutableConfiguration<CLASS extends dev.metaschema.core.model.IBoundObject>
-
disableFeature
- Specified by:
disableFeaturein interfacedev.metaschema.core.configuration.IMutableConfiguration<CLASS extends dev.metaschema.core.model.IBoundObject>
-
applyConfiguration
IDeserializer<CLASS> applyConfiguration(dev.metaschema.core.configuration.IConfiguration<DeserializationFeature<?>> other) - Specified by:
applyConfigurationin interfacedev.metaschema.core.configuration.IMutableConfiguration<CLASS extends dev.metaschema.core.model.IBoundObject>
-
set
- Specified by:
setin interfacedev.metaschema.core.configuration.IMutableConfiguration<CLASS extends dev.metaschema.core.model.IBoundObject>
-
isValidating
Determine if the serializer is performing validation.- Returns:
trueif the serializer is performing content validation, orfalseotherwise
-
getConstraintValidationHandler
@NonNull dev.metaschema.core.model.constraint.IConstraintValidationHandler getConstraintValidationHandler()Get the constraint validation handler configured for this deserializer, which will be used to validate loaded data.- Returns:
- the validation handler
-
setConstraintValidationHandler
void setConstraintValidationHandler(@NonNull dev.metaschema.core.model.constraint.IConstraintValidationHandler handler) Set the constraint violation handler for constraint validation.- Parameters:
handler- the handler to use
-
deserialize
@NonNull default CLASS deserialize(@NonNull InputStream is, @NonNull URI documentUri) throws IOException Read data from theInputStreaminto a bound class instance.- Parameters:
is- the input stream to read fromdocumentUri- the URI of the document to read from- Returns:
- the instance data
- Throws:
IOException- if an error occurred while reading data from the stream
-
deserialize
Read data from thePathinto a bound class instance.- Parameters:
path- the file to read from- Returns:
- the instance data
- Throws:
IOException- if an error occurred while writing data to the file indicated by thepathparameter
-
deserialize
Read data from theFileinto a bound class instance.- Parameters:
file- the file to read from- Returns:
- the instance data
- Throws:
IOException- if an error occurred while reading data from the stream
-
deserialize
Read data from the remote resource into a bound class instance.- Parameters:
url- the remote resource to read from- Returns:
- the instance data
- Throws:
IOException- if an error occurred while reading data from the streamURISyntaxException- if the provided URL is not formatted strictly according to to RFC2396 and cannot be converted to a URI.
-
deserialize
@NonNull default CLASS deserialize(@NonNull Reader reader, @NonNull URI documentUri) throws IOException Read data from theReaderinto a bound class instance.- Parameters:
reader- the reader to read fromdocumentUri- the URI of the document to read from- Returns:
- the instance data
- Throws:
IOException- if an error occurred while reading data from the stream
-
deserializeToNodeItem
@NonNull default dev.metaschema.core.metapath.item.node.INodeItem deserializeToNodeItem(@NonNull InputStream is, @NonNull URI documentUri) throws IOException Read data from theReaderinto a node item instance.- Parameters:
is- the input stream to read fromdocumentUri- the URI of the document to read from- Returns:
- a new node item
- Throws:
IOException- if an error occurred while reading data from the stream
-
deserializeToNodeItem
@NonNull dev.metaschema.core.metapath.item.node.INodeItem deserializeToNodeItem(@NonNull Reader reader, @NonNull URI documentUri) throws IOException Read data from theReaderinto a node item instance.- Parameters:
reader- the reader to read fromdocumentUri- the URI of the document to read from- Returns:
- a new node item
- Throws:
IOException- if an error occurred while reading data from the stream
-
deserializeToValue
@NonNull CLASS deserializeToValue(@NonNull Reader reader, @NonNull URI documentUri) throws IOException Read data from theReaderinto a node item instance.- Parameters:
reader- the reader to read fromdocumentUri- the URI of the document to read from- Returns:
- a new node item
- Throws:
IOException- if an error occurred while reading data from the stream
-