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.
  • Field Details

  • 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 interface org.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 interface org.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 interface CanonicalMapFactory
      Specified by:
      toMarshaled in interface org.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.MarshalException
      Any path elements found in the CanonicalMap beginning with a "@" as of Prefix.ANNOTATION are considered being attributes of their parent path and are marshaled as XML attributes for the according XML element. Providing values for the MarshalParameter.CHARSET, MarshalParameter.COMMENT or the MarshalParameter.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 interface CanonicalMapFactory
      Specified by:
      toMarshaled in interface org.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 interface org.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 interface org.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. a this sub-node assigns a value to it's parent node. E.g. For "xml", the attribute this="value" attached to an element takes care on giving an XML element with children an own value. See AbstractCanonicalMapFactory.THIS_ATTRIBUTES.
      Overrides:
      postProcess in class AbstractCanonicalMapFactory
      Parameters:
      aProperties - The properties where the "this" children are to assign a value to their parents.