Class XmlFieldFormat

    • Constructor Detail

      • XmlFieldFormat

        public XmlFieldFormat()
    • Method Detail

      • insertField

        public void insertField​(MarshallingContext context,
                                java.lang.String fieldText)
        Description copied from interface: FieldFormat
        Inserts field text into a record.
        Specified by:
        insertField in interface FieldFormat
        Parameters:
        context - the MarshallingContext holding the record
        fieldText - the field text to insert into the record
      • insertText

        protected abstract void insertText​(XmlMarshallingContext context,
                                           java.lang.String text)
        Inserts a field into the record during marshalling.
        Parameters:
        context - the XmlMarshallingContext holding the record
        text - the field text to insert
      • extract

        public java.lang.String extract​(UnmarshallingContext context,
                                        boolean reportErrors)
        Description copied from interface: FieldFormat
        Extracts the field text from a record. Returns null if the field was not present in the record.

        May return Value.INVALID if the field is invalid, or Value.NIL if the field is explicitly set to nil or null such as in an XML or JSON formatted stream.

        Implementations should also remove any field padding before returning the text.

        Specified by:
        extract in interface FieldFormat
        Parameters:
        context - the UnmarshallingContext holding the record
        Returns:
        the field text
      • extractText

        protected abstract java.lang.String extractText​(XmlUnmarshallingContext context)
        Extracts a field from a record during unmarshalling.
        Parameters:
        context - the XmlUnmarshallingContext holding the record
        Returns:
        the extracted field text
      • getSize

        public int getSize()
        Description copied from interface: FieldFormat
        Returns the size of the field. Fixed length formats should return the field length, while other formats should simply return 1.
        Specified by:
        getSize in interface FieldFormat
        Returns:
        the size of the field
      • getName

        public java.lang.String getName()
        Returns the field name.
        Returns:
        the field name
      • setName

        public void setName​(java.lang.String name)
        Sets the field name.
        Parameters:
        name - the field name
      • isLazy

        public boolean isLazy()
        Description copied from interface: FieldFormat
        TODO rename isLazy to something better?? Returns whether this field is optionally present in the record.
        Specified by:
        isLazy in interface FieldFormat
        Returns:
        true if lazy, false otherwise
      • setLazy

        public void setLazy​(boolean lazy)
      • getPadding

        public FieldPadding getPadding()
        Returns the field padding, or null if the field text is not padded.
        Returns:
        the field padding or null
      • setPadding

        public void setPadding​(FieldPadding padding)
        Sets the field padding.
        Parameters:
        padding - the field padding
      • toParamString

        protected void toParamString​(java.lang.StringBuilder s)
        Called by toString() to append attributes of this field.
        Parameters:
        s - the text to append
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object