Class Id

    • Constructor Summary

      Constructors 
      Constructor Description
      Id​(CharacterSet set)
      Creates a new instance of Id
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void addChild​(DataModelPart child)
      Add a child DataModelPart to this tree
      protected void checkType​(ContainerPart container, java.lang.String expectedType)  
      protected java.lang.String convertNull​(java.lang.String s, boolean toEmptyString)  
      void document​(java.lang.StringBuffer sb, int indent)  
      protected byte[] escapeCharacters​(byte[] bytes, char character, char escape, java.lang.String charset)  
      DataModelPart getChild​(int index)
      Return the child DataModelPart held at the specified index
      int getChildCount()
      Returns the number of child DataModelParts held by this DataModelPart
      java.util.ArrayList getChildList​(java.lang.String type, java.lang.String id)
      Method to retrieve child elements keyed by Type and ID values
      java.lang.String getId()
      Gets the ID of this DataModelPart
      DataModelPart getParent()
      Gets the parent of this DataModelPart
      int getRepetitions()
      returns the number of times that the data represented by this DataModelPart may repeat in a file.
      DataModelPart getRoot()
      Gets the Root DataModelPart of this tree
      java.lang.String getType()
      Returns the type of this DataModelPart
      ContainerPart parse​(StreamParser input, Options options)
      Parses a section of an input file provided in the supplied StreamParser.
      void produce​(java.io.OutputStream output, ContainerPart container, java.lang.String charset, Options options)  
      void resort()
      method to re-sort the child DataModelParts, useful if either ID or or Type values have changed
      void setId​(java.lang.String id)
      Sets the ID of this DataModelPart
      void setParent​(DataModelPart parent)
      Sets the parent of this DataModelPart
      void setRepetitions​(int repetitions)
      sets the number of times that the data represented by this DataModelPart may repeat in a file.
      void setRoot​(DataModelPart root)
      Sets the Root DataModelPart of this tree recursively.
      void setType​(java.lang.String type)
      Sets the type of this DataModelPart
      protected byte[] stripCharacters​(byte[] bytes, char character, char escape, java.lang.String charset)  
      boolean supportsChild​(int dataModelPartType)
      always returns false as Id cannot support children
      void undoRead()
      returns the read section to the StreamParser for re-reading
      void validate​(ContainerPart container)
      dummy method - not yet implemented
      void writeXML​(java.io.OutputStream out, int indent)  
      void writeXML​(java.io.Writer out, int indent)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • log

        protected transient org.slf4j.Logger log
    • Constructor Detail

      • Id

        public Id​(CharacterSet set)
           throws java.lang.Exception
        Creates a new instance of Id
        Throws:
        java.lang.Exception
    • Method Detail

      • parse

        public ContainerPart parse​(StreamParser input,
                                   Options options)
                            throws ModelException
        Parses a section of an input file provided in the supplied StreamParser.
        Parameters:
        input - the StreamParser to parse
        Returns:
        ContainerPart tree containing the structure of the parsed data
        Throws:
        ModelException - if an error is encountered
      • supportsChild

        public boolean supportsChild​(int dataModelPartType)
        always returns false as Id cannot support children
      • setRoot

        public void setRoot​(DataModelPart root)
        Sets the Root DataModelPart of this tree recursively. Will propogate the root element to all child DataModelParts.
        Specified by:
        setRoot in interface DataModelPart
        Parameters:
        root - DataModelPart
      • getChildCount

        public int getChildCount()
        Returns the number of child DataModelParts held by this DataModelPart
        Specified by:
        getChildCount in interface DataModelPart
      • setId

        public void setId​(java.lang.String id)
        Sets the ID of this DataModelPart
        Specified by:
        setId in interface DataModelPart
      • setType

        public void setType​(java.lang.String type)
        Sets the type of this DataModelPart
        Specified by:
        setType in interface DataModelPart
      • getRepetitions

        public int getRepetitions()
        returns the number of times that the data represented by this DataModelPart may repeat in a file. E.g. a DataModelPart representing a Line Record in a file would probably specify a repetitions value of zero, indicating that unlimited repetitions may ocur
        Specified by:
        getRepetitions in interface DataModelPart
      • setRepetitions

        public void setRepetitions​(int repetitions)
        sets the number of times that the data represented by this DataModelPart may repeat in a file.
        Specified by:
        setRepetitions in interface DataModelPart
      • document

        public void document​(java.lang.StringBuffer sb,
                             int indent)
        Specified by:
        document in interface DataModelPart
      • getChildList

        public java.util.ArrayList getChildList​(java.lang.String type,
                                                java.lang.String id)
                                         throws ModelException
        Method to retrieve child elements keyed by Type and ID values
        Specified by:
        getChildList in interface DataModelPart
        Parameters:
        type - the type of element to retrieve
        id - the id of the element to retrieve
        Returns:
        ArrayList containing the retrieved elements
        Throws:
        ModelException
      • resort

        public void resort()
        method to re-sort the child DataModelParts, useful if either ID or or Type values have changed
        Specified by:
        resort in interface DataModelPart
      • stripCharacters

        protected byte[] stripCharacters​(byte[] bytes,
                                         char character,
                                         char escape,
                                         java.lang.String charset)
      • escapeCharacters

        protected byte[] escapeCharacters​(byte[] bytes,
                                          char character,
                                          char escape,
                                          java.lang.String charset)
      • convertNull

        protected java.lang.String convertNull​(java.lang.String s,
                                               boolean toEmptyString)