Class JaxbBuilder

    • Field Detail

      • object

        private final java.lang.Object object
      • marshaller

        private javax.xml.bind.Marshaller marshaller
      • userObjectFactory

        private boolean userObjectFactory
    • Constructor Detail

      • JaxbBuilder

        protected JaxbBuilder​(java.lang.Object object)
        Creates a builder based on the given object.
    • Method Detail

      • withMarshaller

        public JaxbBuilder withMarshaller​(javax.xml.bind.Marshaller marshaller)
        Sets a non-default Marshaller to use when creating the Source.
      • useObjectFactory

        public JaxbBuilder useObjectFactory()
        If the given Object has no XmlRootElement annotation and is not an instants of JAXBElement it must be wrapped by a JAXBElement.

        This method will find the ObjectFactory class (normally generated by jaxb) and use the first matching factory-method for the given Object to create the JAXBElement-Wrapper.

        If no ObjectFactory and method exists for the given object, the default behavior (same behavior as by JAXB) will be used to create the JAXBElement-Wrapper for the given Object.

        If you don't use the xjc:simple flag to generate your JAXB-Objects, the use of the OjectFactory is most likely required to generate Schema-Valid XML.

      • build

        public javax.xml.transform.Source build()
        Description copied from interface: Input.Builder
        build the actual Source instance.
        Specified by:
        build in interface Input.Builder
      • getPreparedJaxbObject

        private java.lang.Object getPreparedJaxbObject()
      • createDefaultMarshaller

        private void createDefaultMarshaller()
                                      throws javax.xml.bind.JAXBException,
                                             javax.xml.bind.PropertyException
        Throws:
        javax.xml.bind.JAXBException
        javax.xml.bind.PropertyException
      • createInferredJAXBElement

        private static <T> javax.xml.bind.JAXBElement<T> createInferredJAXBElement​(T object)
      • createJAXBElement

        private static <T> javax.xml.bind.JAXBElement<T> createJAXBElement​(T jaxbObj)
      • createJaxbElementFromObjectFactory

        private static <T> javax.xml.bind.JAXBElement<T> createJaxbElementFromObjectFactory​(T obj)
      • getObjectFactoryClass

        private static <T> java.lang.Class<?> getObjectFactoryClass​(T obj)
                                                             throws java.lang.ClassNotFoundException
        Throws:
        java.lang.ClassNotFoundException
      • inferName

        private static java.lang.String inferName​(java.lang.Class clazz)