Class MarshallerImpl

    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void debug()
      Prints the internal view of the stream configuration to System.out
      void debug​(java.io.PrintStream out)
      Prints the internal view of the stream configuration.
      protected java.lang.Object getRecordValue()
      Returns the record value for the most recent marshalled bean object.
      Marshaller marshal​(java.lang.Object bean)
      Marshals a single bean object.
      Marshaller marshal​(java.lang.String recordName, java.lang.Object bean)
      Marshals a single bean object.
      java.lang.String[] toArray()
      Returns the most recent marshalled bean object as a String[] for csv and delimited formatted streams.
      org.w3c.dom.Document toDocument()
      Returns the most recent marshalled bean object as a Document for xml formatted streams.
      java.util.List<java.lang.String> toList()
      Returns the most recent marshalled bean object as a List for csv and delimited formatted streams.
      java.lang.String toString()
      Returns the most recent marshalled bean object as a String.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Method Detail

      • marshal

        public Marshaller marshal​(java.lang.Object bean)
                           throws BeanWriterException
        Description copied from interface: Marshaller
        Marshals a single bean object.
        Specified by:
        marshal in interface Marshaller
        Parameters:
        bean - the bean object to marshal
        Returns:
        this Marshaller
        Throws:
        BeanWriterException - if a record is not matched for the given bean object, or in some other rare (but fatal) conditions
        InvalidBeanException - if BeanIO is configured to validate fields during marshalling, and a field does not meet the configured validation rules
      • marshal

        public Marshaller marshal​(java.lang.String recordName,
                                  java.lang.Object bean)
                           throws BeanWriterException
        Description copied from interface: Marshaller
        Marshals a single bean object.
        Specified by:
        marshal in interface Marshaller
        Parameters:
        recordName - the name of the record to marshal
        bean - the bean object to marshal
        Returns:
        this Marshaller
        Throws:
        BeanWriterException - if a record is not matched for the given record name and bean object, or in some other rare (but fatal) conditions
        InvalidBeanException - if BeanIO is configured to validate fields during marshalling, and a field does not meet the configured validation rules
      • toString

        public java.lang.String toString()
        Description copied from interface: Marshaller
        Returns the most recent marshalled bean object as a String. This method is supported by all stream formats.
        Specified by:
        toString in interface Marshaller
        Overrides:
        toString in class java.lang.Object
        Returns:
        the record text
      • toArray

        public java.lang.String[] toArray()
                                   throws BeanWriterException
        Description copied from interface: Marshaller
        Returns the most recent marshalled bean object as a String[] for csv and delimited formatted streams.
        Specified by:
        toArray in interface Marshaller
        Returns:
        the String array of fields
        Throws:
        BeanWriterException - if an array is not supported by the stream format
      • toList

        public java.util.List<java.lang.String> toList()
                                                throws BeanWriterException
        Description copied from interface: Marshaller
        Returns the most recent marshalled bean object as a List for csv and delimited formatted streams.
        Specified by:
        toList in interface Marshaller
        Returns:
        the List of fields
        Throws:
        BeanWriterException - if an array is not supported by the stream format
      • toDocument

        public org.w3c.dom.Document toDocument()
                                        throws BeanWriterException
        Description copied from interface: Marshaller
        Returns the most recent marshalled bean object as a Document for xml formatted streams.
        Specified by:
        toDocument in interface Marshaller
        Returns:
        the Document
        Throws:
        BeanWriterException - if Document is not supported by the stream format
      • getRecordValue

        protected java.lang.Object getRecordValue()
        Returns the record value for the most recent marshalled bean object.
        Returns:
        the record value
      • debug

        public void debug()
        Description copied from interface: Debuggable
        Prints the internal view of the stream configuration to System.out
        Specified by:
        debug in interface Debuggable
      • debug

        public void debug​(java.io.PrintStream out)
        Description copied from interface: Debuggable
        Prints the internal view of the stream configuration.
        Specified by:
        debug in interface Debuggable
        Parameters:
        out - the PrintStream to write to