Class AbstractMarshallerImpl

    • Constructor Detail

      • AbstractMarshallerImpl

        public AbstractMarshallerImpl()
    • Method Detail

      • getNode

        public Node getNode​(Object obj)
                     throws JAXBException
        By default, the getNode method is unsupported and throw an UnsupportedOperationException. Implementations that choose to support this method must override this method.
        Specified by:
        getNode in interface Marshaller
        Parameters:
        obj - - JAXB Java representation of XML content
        Returns:
        the DOM tree view of the contentTree
        Throws:
        JAXBException - If any unexpected problem occurs
      • getEncoding

        protected String getEncoding()
        Convenience method for getting the current output encoding.
        Returns:
        the current encoding or "UTF-8" if it hasn't been set.
      • setEncoding

        protected void setEncoding​(String encoding)
        Convenience method for setting the output encoding.
        Parameters:
        encoding - a valid encoding as specified in the Marshaller class documentation
      • getSchemaLocation

        protected String getSchemaLocation()
        Convenience method for getting the current schemaLocation.
        Returns:
        the current schemaLocation or null if it hasn't been set
      • setSchemaLocation

        protected void setSchemaLocation​(String location)
        Convenience method for setting the schemaLocation.
        Parameters:
        location - the schemaLocation value
      • getNoNSSchemaLocation

        protected String getNoNSSchemaLocation()
        Convenience method for getting the current noNamespaceSchemaLocation.
        Returns:
        the current noNamespaceSchemaLocation or null if it hasn't been set
      • setNoNSSchemaLocation

        protected void setNoNSSchemaLocation​(String location)
        Convenience method for setting the noNamespaceSchemaLocation.
        Parameters:
        location - the noNamespaceSchemaLocation value
      • isFormattedOutput

        protected boolean isFormattedOutput()
        Convenience method for getting the formatted output flag.
        Returns:
        the current value of the formatted output flag or false if it hasn't been set.
      • setFormattedOutput

        protected void setFormattedOutput​(boolean v)
        Convenience method for setting the formatted output flag.
        Parameters:
        v - value of the formatted output flag.
      • isFragment

        protected boolean isFragment()
        Convenience method for getting the fragment flag.
        Returns:
        the current value of the fragment flag or false if it hasn't been set.
      • setFragment

        protected void setFragment​(boolean v)
        Convenience method for setting the fragment flag.
        Parameters:
        v - value of the fragment flag.
      • getJavaEncoding

        protected String getJavaEncoding​(String encoding)
                                  throws UnsupportedEncodingException
        Gets the corresponding Java encoding name from an IANA name. This method is a helper method for the derived class to convert encoding names.
        Throws:
        UnsupportedEncodingException - If this implementation couldn't find the Java encoding name.
      • setProperty

        public void setProperty​(String name,
                                Object value)
                         throws PropertyException
        Default implementation of the setProperty method handles the four defined properties in Marshaller. If a provider needs to handle additional properties, it should override this method in a derived class.
        Specified by:
        setProperty in interface Marshaller
        Parameters:
        name - the name of the property to be set. This value can either be specified using one of the constant fields or a user supplied string.
        value - the value of the property to be set
        Throws:
        PropertyException - when there is an error processing the given property or value
      • getProperty

        public Object getProperty​(String name)
                           throws PropertyException
        Default implementation of the getProperty method handles the four defined properties in Marshaller. If a provider needs to support additional provider specific properties, it should override this method in a derived class.
        Specified by:
        getProperty in interface Marshaller
        Parameters:
        name - the name of the property to retrieve
        Returns:
        the value of the requested property
        Throws:
        PropertyException - when there is an error retrieving the given property or value property name
      • setEventHandler

        public void setEventHandler​(ValidationEventHandler handler)
                             throws JAXBException
        Description copied from interface: Marshaller
        Allow an application to register a validation event handler.

        The validation event handler will be called by the JAXB Provider if any validation errors are encountered during calls to any of the marshal API's. If the client application does not register a validation event handler before invoking one of the marshal methods, then validation events will be handled by the default event handler which will terminate the marshal operation after the first error or fatal error is encountered.

        Calling this method with a null parameter will cause the Marshaller to revert back to the default default event handler.

        Specified by:
        setEventHandler in interface Marshaller
        Parameters:
        handler - the validation event handler
        Throws:
        JAXBException - if an error was encountered while setting the event handler
        See Also:
        Marshaller.setEventHandler(ValidationEventHandler)