Class AbstractCanonicalMapFactory

  • All Implemented Interfaces:
    org.refcodes.factory.MarshalTypeFactory<org.refcodes.structure.CanonicalMap.CanonicalMapBuilder,java.lang.String>, org.refcodes.factory.MarshalTypeFactory.MarshalTypeFactoryComplement<org.refcodes.structure.CanonicalMap.CanonicalMapBuilder,java.lang.String>, org.refcodes.factory.MarshalTypeFactory.MarshalTypeFactoryComposite<org.refcodes.structure.CanonicalMap.CanonicalMapBuilder,java.lang.String,java.io.InputStream>, org.refcodes.factory.UnmarshalTypeFactory<org.refcodes.structure.CanonicalMap.CanonicalMapBuilder,java.lang.String>, org.refcodes.factory.UnmarshalTypeFactory.UnmarshalTypeFactoryComplement<org.refcodes.structure.CanonicalMap.CanonicalMapBuilder,java.lang.String>, org.refcodes.factory.UnmarshalTypeFactory.UnmarshalTypeFactoryComposite<org.refcodes.structure.CanonicalMap.CanonicalMapBuilder,java.lang.String,java.io.InputStream>, CanonicalMapFactory
    Direct Known Subclasses:
    HtmlCanonicalMapFactory, JavaCanonicalMapFactory, JsonCanonicalMapFactory, TomlCanonicalMapFactory, XmlCanonicalMapFactory, YamlCanonicalMapFactory


    public abstract class AbstractCanonicalMapFactory
    extends java.lang.Object
    implements CanonicalMapFactory
    Base class for the CanonicalMapFactory providing base functionality.
    • Nested Class Summary

      • Nested classes/interfaces inherited from interface org.refcodes.factory.MarshalTypeFactory

        org.refcodes.factory.MarshalTypeFactory.MarshalTypeFactoryComplement<T extends java.lang.Object,C extends java.lang.Object>, org.refcodes.factory.MarshalTypeFactory.MarshalTypeFactoryComposite<T extends java.lang.Object,SRC extends java.lang.Object,C extends java.lang.Object>
      • Nested classes/interfaces inherited from interface org.refcodes.factory.UnmarshalTypeFactory

        org.refcodes.factory.UnmarshalTypeFactory.UnmarshalTypeFactoryComplement<T extends java.lang.Object,C extends java.lang.Object>, org.refcodes.factory.UnmarshalTypeFactory.UnmarshalTypeFactoryComposite<T extends java.lang.Object,SRC extends java.lang.Object,C extends java.lang.Object>
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected void postProcessAttributes​(org.refcodes.structure.CanonicalMap.CanonicalMapBuilder aProperties)
      This method takes care on giving nodes with children an own value: E.g.
      protected java.lang.String toComment​(java.util.Map<java.lang.String,java.lang.String> aProperties)
      Retrieves the comment to be used in the header of the marshaled representation.
      protected char toDelimiter​(java.util.Map<java.lang.String,java.lang.String> aProperties, char aDefaultDelimiter)
      Retrieves the delimiter to be used for the data structure.
      protected java.io.InputStream toInputStream​(java.lang.String aString)
      Converts the given String to an InputStream.
      protected java.lang.String toString​(java.io.InputStream aInputStream)
      Converts the given InputStream to a String.
      protected char[] toSupportedDelimiters​(java.util.Map<java.lang.String,java.lang.String> aProperties)
      Retrieves the supported delimiters to be used when unmarshaling an external representation.
      protected static java.lang.String toXml​(org.refcodes.structure.CanonicalMap aCanonicalMap)
      Converts a CanonicalMap to XML.
      • Methods inherited from interface org.refcodes.factory.MarshalTypeFactory.MarshalTypeFactoryComplement

        fromUnmarshaled, fromUnmarshaled
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • Methods inherited from interface org.refcodes.factory.UnmarshalTypeFactory.UnmarshalTypeFactoryComplement

        fromMarshaled, fromMarshaled
    • Constructor Detail

      • AbstractCanonicalMapFactory

        public AbstractCanonicalMapFactory​()
    • Method Detail

      • postProcessAttributes

        protected void postProcessAttributes​(org.refcodes.structure.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 THIS_ATTRIBUTES.
        Parameters:
        aProperties - The properties where the "this" children are to assign a value to their parents.
      • toString

        protected java.lang.String toString​(java.io.InputStream aInputStream)
                                     throws java.io.IOException
        Converts the given InputStream to a String.
        Parameters:
        aInputStream - The InputStream to be converted.
        Returns:
        The according String.
        Throws:
        java.io.IOException - thrown in case conversion failed.
      • toInputStream

        protected java.io.InputStream toInputStream​(java.lang.String aString)
        Converts the given String to an InputStream.
        Parameters:
        aString - The String to be converted.
        Returns:
        The according InputStream.
      • toDelimiter

        protected char toDelimiter​(java.util.Map<java.lang.String,java.lang.String> aProperties,
                                   char aDefaultDelimiter)
        Retrieves the delimiter to be used for the data structure.
        Parameters:
        aProperties - The properties from which to retrieve the delimiter.
        aDefaultDelimiter - The delimiter to be used when there is none in the properties defined.
        Returns:
        The according delimiter or the PathMap.DELIMITER if none was provided in the properties.
      • toSupportedDelimiters

        protected char[] toSupportedDelimiters​(java.util.Map<java.lang.String,java.lang.String> aProperties)
        Retrieves the supported delimiters to be used when unmarshaling an external representation.
        Parameters:
        aProperties - The properties from which to retrieve the supported delimiters. Them delimiters are provided in a String.
        Returns:
        The according supported delimiters or the PathMap.DELIMITER if none was provided in the properties.
      • toComment

        protected java.lang.String toComment​(java.util.Map<java.lang.String,java.lang.String> aProperties)
        Retrieves the comment to be used in the header of the marshaled representation.
        Parameters:
        aProperties - The properties from which to retrieve the comment.
        Returns:
        The according delimiter or the CanonicalMap.DEFAULT_COMMENT if none was provided in the properties.
      • toXml

        protected static java.lang.String toXml​(org.refcodes.structure.CanonicalMap aCanonicalMap)
        Converts a CanonicalMap to XML.
        Parameters:
        aCanonicalMap - The CanonicalMap to marshal.
        Returns:
        The resulting XML.