Package org.refcodes.struct.ext.factory
Class XmlCanonicalMapFactory
java.lang.Object
org.refcodes.struct.ext.factory.AbstractCanonicalMapFactory
org.refcodes.struct.ext.factory.XmlCanonicalMapFactory
- All Implemented Interfaces:
org.refcodes.factory.MarshalTypeFactory<org.refcodes.struct.CanonicalMap,
,String> org.refcodes.factory.MarshalTypeFactory.MarshalTypeFactoryComplement<org.refcodes.struct.CanonicalMap,
,InputStream> org.refcodes.factory.MarshalTypeFactory.MarshalTypeFactoryComposite<org.refcodes.struct.CanonicalMap,
,String, InputStream> org.refcodes.factory.UnmarshalTypeFactory<org.refcodes.struct.CanonicalMap.CanonicalMapBuilder,
,String> org.refcodes.factory.UnmarshalTypeFactory.UnmarshalTypeFactoryComplement<org.refcodes.struct.CanonicalMap.CanonicalMapBuilder,
,InputStream> org.refcodes.factory.UnmarshalTypeFactory.UnmarshalTypeFactoryComposite<org.refcodes.struct.CanonicalMap.CanonicalMapBuilder,
,String, InputStream> CanonicalMapFactory
- Direct Known Subclasses:
XmlCanonicalMapFactorySingleton
public class XmlCanonicalMapFactory
extends AbstractCanonicalMapFactory
implements CanonicalMapFactory
Implementation of the
CanonicalMapFactory
for parsing the XML
notation.-
Nested Class Summary
Nested classes/interfaces inherited from interface org.refcodes.factory.MarshalTypeFactory
org.refcodes.factory.MarshalTypeFactory.MarshalTypeFactoryComplement<T extends Object,
C extends Object>, org.refcodes.factory.MarshalTypeFactory.MarshalTypeFactoryComposite<T extends Object, SRC extends Object, C extends Object> Nested classes/interfaces inherited from interface org.refcodes.factory.UnmarshalTypeFactory
org.refcodes.factory.UnmarshalTypeFactory.UnmarshalTypeFactoryComplement<T extends Object,
C extends Object>, org.refcodes.factory.UnmarshalTypeFactory.UnmarshalTypeFactoryComposite<T extends Object, SRC extends Object, C extends Object> -
Field Summary
Modifier and TypeFieldDescriptionstatic final String
static final String
protected static final String
Fields inherited from interface org.refcodes.struct.ext.factory.CanonicalMapFactory
COMMENT_PROPERTY, DELIMITER_PROPERTY, SUPPORTED_DELIMITERS_PROPERTY
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionorg.refcodes.struct.CanonicalMap.CanonicalMapBuilder
fromMarshaled
(InputStream aExternalRepresentation) org.refcodes.struct.CanonicalMap.CanonicalMapBuilder
fromMarshaled
(InputStream aExternalRepresentation, Map<String, String> aProperties) fromUnmarshaled
(org.refcodes.struct.CanonicalMap aDataStructure) fromUnmarshaled
(org.refcodes.struct.CanonicalMap aDataStructure, Map<String, String> aProperties) protected void
postProcess
(org.refcodes.struct.CanonicalMap.CanonicalMapBuilder aProperties) This method takes care on giving nodes with children an own value: E.g.toMarshaled
(org.refcodes.struct.CanonicalMap aDataStructure) toMarshaled
(org.refcodes.struct.CanonicalMap aDataStructure, Map<String, String> aProperties) Any path elements found in theCanonicalMap
beginning with a "@" as ofPrefix.ANNOTATION
are considered being attributes of their parent path and are marshaled as XML attributes for the according XML element.Methods inherited from class org.refcodes.struct.ext.factory.AbstractCanonicalMapFactory
toComment, toDelimiter, toInputStream, toString, toSupportedDelimiters, toXml
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.refcodes.struct.ext.factory.CanonicalMapFactory
toUnmarshaled, toUnmarshaled
-
Field Details
-
ROOT_SELECTOR
- See Also:
-
COMMENT_OPEN
- See Also:
-
COMMENT_CLOSE
- See Also:
-
-
Constructor Details
-
XmlCanonicalMapFactory
public XmlCanonicalMapFactory()
-
-
Method Details
-
fromMarshaled
public org.refcodes.struct.CanonicalMap.CanonicalMapBuilder fromMarshaled(InputStream aExternalRepresentation) throws org.refcodes.exception.UnmarshalException - Specified by:
fromMarshaled
in interfaceorg.refcodes.factory.UnmarshalTypeFactory.UnmarshalTypeFactoryComplement<org.refcodes.struct.CanonicalMap.CanonicalMapBuilder,
InputStream> - Throws:
org.refcodes.exception.UnmarshalException
-
fromMarshaled
public org.refcodes.struct.CanonicalMap.CanonicalMapBuilder fromMarshaled(InputStream aExternalRepresentation, Map<String, String> aProperties) throws org.refcodes.exception.UnmarshalException- Specified by:
fromMarshaled
in interfaceorg.refcodes.factory.UnmarshalTypeFactory.UnmarshalTypeFactoryComplement<org.refcodes.struct.CanonicalMap.CanonicalMapBuilder,
InputStream> - Throws:
org.refcodes.exception.UnmarshalException
-
toMarshaled
public String toMarshaled(org.refcodes.struct.CanonicalMap aDataStructure) throws org.refcodes.exception.MarshalException - Specified by:
toMarshaled
in interfaceCanonicalMapFactory
- Specified by:
toMarshaled
in interfaceorg.refcodes.factory.MarshalTypeFactory<org.refcodes.struct.CanonicalMap,
String> - Throws:
org.refcodes.exception.MarshalException
-
toMarshaled
public String toMarshaled(org.refcodes.struct.CanonicalMap aDataStructure, Map<String, String> aProperties) throws org.refcodes.exception.MarshalExceptionAny path elements found in theCanonicalMap
beginning with a "@" as ofPrefix.ANNOTATION
are considered being attributes of their parent path and are marshaled as XML attributes for the according XML element. Providing values for theMarshalParameter.CHARSET
,MarshalParameter.COMMENT
or theMarshalParameter.VERSION
parameter in the provided properties you can influence the creation of the<?xml ecnoding="UTF-8" version="1.0" standalone="yes"?>
declaration in the resulting XML.- Specified by:
toMarshaled
in interfaceCanonicalMapFactory
- Specified by:
toMarshaled
in interfaceorg.refcodes.factory.MarshalTypeFactory<org.refcodes.struct.CanonicalMap,
String> - Throws:
org.refcodes.exception.MarshalException
-
fromUnmarshaled
public InputStream fromUnmarshaled(org.refcodes.struct.CanonicalMap aDataStructure) throws org.refcodes.exception.MarshalException - Specified by:
fromUnmarshaled
in interfaceorg.refcodes.factory.MarshalTypeFactory.MarshalTypeFactoryComplement<org.refcodes.struct.CanonicalMap,
InputStream> - Throws:
org.refcodes.exception.MarshalException
-
fromUnmarshaled
public InputStream fromUnmarshaled(org.refcodes.struct.CanonicalMap aDataStructure, Map<String, String> aProperties) throws org.refcodes.exception.MarshalException- Specified by:
fromUnmarshaled
in interfaceorg.refcodes.factory.MarshalTypeFactory.MarshalTypeFactoryComplement<org.refcodes.struct.CanonicalMap,
InputStream> - Throws:
org.refcodes.exception.MarshalException
-
postProcess
protected void postProcess(org.refcodes.struct.CanonicalMap.CanonicalMapBuilder aProperties) This method takes care on giving nodes with children an own value: E.g. "yaml" files cannot have a value for a node which has sub-nodes, same applies to "json" and "xml" which makes using the "mixed content" mechanism hard. When we require a value for a node (path) which may have sub-nodes (sub-paths), then e.g. athis
sub-node assigns a value to it's parent node. E.g. For "xml", the attributethis="value"
attached to an element takes care on giving an XML element with children an own value. SeeAbstractCanonicalMapFactory.THIS_ATTRIBUTES
.- Overrides:
postProcess
in classAbstractCanonicalMapFactory
- Parameters:
aProperties
- The properties where the "this" children are to assign a value to their parents.
-