Class Bind


  • public class Bind
    extends java.lang.Object
    Helper class for JAXB binding. Responsible for marshalling and unmarshalling using given schema and context.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private javax.xml.bind.Marshaller marshaller  
      private javax.xml.bind.Unmarshaller unmarshaller  
    • Constructor Summary

      Constructors 
      Constructor Description
      Bind​(javax.xml.bind.JAXBContext context, javax.xml.validation.Schema schema)
      Creates Bind.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void marshal​(java.io.Writer writer, java.lang.Object object)
      Writes given object to given writer validating it.
      void marshal​(java.lang.String fileName, java.lang.Object object)
      Writes given object to a file with given name validating it.
      java.lang.Object unmarshal​(java.io.Reader reader)
      Retrieves object from given reader validation the input.
      java.lang.Object unmarshal​(java.lang.String fileName)
      Retrieves object from a file with given name validating the input.
      • Methods inherited from class java.lang.Object

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

      • marshaller

        private javax.xml.bind.Marshaller marshaller
      • unmarshaller

        private javax.xml.bind.Unmarshaller unmarshaller
    • Constructor Detail

      • Bind

        public Bind​(javax.xml.bind.JAXBContext context,
                    javax.xml.validation.Schema schema)
        Creates Bind.
        Parameters:
        context - JAXB context
        schema - XML schema
    • Method Detail

      • marshal

        public void marshal​(java.io.Writer writer,
                            java.lang.Object object)
        Writes given object to given writer validating it.
        Parameters:
        writer -
        object -
      • marshal

        public void marshal​(java.lang.String fileName,
                            java.lang.Object object)
        Writes given object to a file with given name validating it.
        Parameters:
        fileName -
        object -
      • unmarshal

        public java.lang.Object unmarshal​(java.io.Reader reader)
        Retrieves object from given reader validation the input.
        Parameters:
        reader -
        Returns:
        object
      • unmarshal

        public java.lang.Object unmarshal​(java.lang.String fileName)
        Retrieves object from a file with given name validating the input.
        Parameters:
        fileName -
        Returns:
        object