Package org.codice.ddf.parser
Interface Parser
public interface Parser
Defines a service interface for converting between Objects and external representations of them.
Objects can be represented in a myriad of ways for transport and interoperability with other
systems; this service is intended to isolate some of the more particular needs of various
conversion libraries.
-
Method Summary
Modifier and TypeMethodDescriptionconfigureParser(List<String> contextPath, ClassLoader loader) Creates an initial configurator object to be used to facilitate the marshaling and unmarshaling processes.voidmarshal(ParserConfigurator configurator, Object obj, OutputStream os) Converts an object graph into the appropriate output format, writing it to the given stream.voidmarshal(ParserConfigurator configurator, Object obj, Node node) Converts an object graph into a Node,<T> Tunmarshal(ParserConfigurator configurator, Class<? extends T> cls, InputStream stream) Converts a representation of an object graph into an instance of typeT.<T> Tunmarshal(ParserConfigurator configurator, Class<? extends T> cls, Source source) Converts a representation of an object graph into an instance of typeT.<T> Tunmarshal(ParserConfigurator configurator, Class<? extends T> cls, Node node) Converts a representation of an object graph into an instance of typeT.
-
Method Details
-
configureParser
Creates an initial configurator object to be used to facilitate the marshaling and unmarshaling processes.- Parameters:
contextPath- a list of paths that implementations can search in order to find binding informationloader- the classloader for the parser to use- Returns:
- a configuration object with the specified
contextPathandloader
-
marshal
Converts an object graph into the appropriate output format, writing it to the given stream.- Parameters:
configurator- object containing the relevant configuration information needed to perform the conversionobj- the root of the object graph to convertos- the output stream on which the converted object is written- Throws:
ParserException
-
marshal
Converts an object graph into a Node,- Parameters:
configurator-obj-node-- Throws:
ParserException
-
unmarshal
<T> T unmarshal(ParserConfigurator configurator, Class<? extends T> cls, InputStream stream) throws ParserException Converts a representation of an object graph into an instance of typeT.- Type Parameters:
T- expected return object- Parameters:
configurator- object containing the relevant configuration information needed to perform the conversioncls-Classfor the conversionstream- input stream which is read for the object data- Returns:
- an object of type
Tas read and converted from the stream - Throws:
ParserException
-
unmarshal
<T> T unmarshal(ParserConfigurator configurator, Class<? extends T> cls, Node node) throws ParserException Converts a representation of an object graph into an instance of typeT.- Type Parameters:
T-- Parameters:
cls-node-- Returns:
- an object of type
Tas read and converted from the node - Throws:
ParserException
-
unmarshal
<T> T unmarshal(ParserConfigurator configurator, Class<? extends T> cls, Source source) throws ParserException Converts a representation of an object graph into an instance of typeT.- Type Parameters:
T-- Parameters:
cls-source-- Returns:
- an object of type
Tas read and converted from the source - Throws:
ParserException
-