public class JaxbBuilder extends Object implements Input.Builder
Input.Builder
for Jaxb-Object and creating a JAXBSource
.
If no custom Marshaller
is set by withMarshaller(Marshaller)
, then the same logic as in JAXB
is used the create a default Marshaller
.
Modifier | Constructor and Description |
---|---|
protected |
JaxbBuilder(Object object)
Creates a builder based on the given object.
|
Modifier and Type | Method and Description |
---|---|
Source |
build()
build the actual
Source instance. |
JaxbBuilder |
useObjectFactory()
If the given Object has no
XmlRootElement annotation and is not an instants of JAXBElement it
must be wrapped by a JAXBElement . |
JaxbBuilder |
withMarshaller(Marshaller marshaller)
Sets a non-default
Marshaller to use when creating the Source . |
protected JaxbBuilder(Object object)
public JaxbBuilder withMarshaller(Marshaller marshaller)
Marshaller
to use when creating the Source
.public JaxbBuilder useObjectFactory()
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.
public Source build()
Input.Builder
Source
instance.build
in interface Input.Builder
Copyright © 2001–2017 XMLUnit. All rights reserved.