Package org.xmlunit.builder
Class JaxbBuilder
java.lang.Object
org.xmlunit.builder.JaxbBuilder
- All Implemented Interfaces:
Input.Builder
- Direct Known Subclasses:
JavaxJaxbBuilder
Input.Builder for Jaxb-Object and creating a JAXBSource.-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedJaxbBuilder(Object object) Creates a builder based on the given object. -
Method Summary
Modifier and TypeMethodDescriptionprotected final ObjectProvides the custom Marshaller.protected final ObjectProvides the configured object.protected final booleanProvides whether the given Object has noXmlRootElementannotation and is not an instants ofJAXBElementit must be wrapped by aJAXBElement.Whether the given Object has noXmlRootElementannotation and is not an instants ofJAXBElementit must be wrapped by aJAXBElement.withMarshaller(Object marshaller) Sets a non-defaultMarshallerto use when creating theSource.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.xmlunit.builder.Input.Builder
build
-
Constructor Details
-
JaxbBuilder
Creates a builder based on the given object.- Parameters:
object- the object to build a source of
-
-
Method Details
-
withMarshaller
Sets a non-defaultMarshallerto use when creating theSource.- Parameters:
marshaller- the Marshaller to use- Returns:
- this
-
useObjectFactory
Whether the given Object has noXmlRootElementannotation and is not an instants ofJAXBElementit must be wrapped by aJAXBElement.This method will find the
ObjectFactoryclass (normally generated by jaxb) and use the first matching factory-method for the given Object to create theJAXBElement-Wrapper.If no ObjectFactory and method exists for the given object, the default behavior (same behavior as by
JAXB) will be used to create theJAXBElement-Wrapper for the given Object.If you don't use the
xjc:simpleflag to generate your JAXB-Objects, the use of the OjectFactory is most likely required to generate Schema-Valid XML.- Returns:
- this
-
getObject
Provides the configured object.- Returns:
- the configured object
- Since:
- 2.9.0
-
getMarshaller
Provides the custom Marshaller.- Returns:
- the configured Marshaller
- Since:
- 2.9.0
-
getUseObjectFactory
protected final boolean getUseObjectFactory()Provides whether the given Object has noXmlRootElementannotation and is not an instants ofJAXBElementit must be wrapped by aJAXBElement.- Returns:
- whether the given Object has no
XmlRootElementannotation and is not an instants ofJAXBElementit must be wrapped by aJAXBElement. - Since:
- 2.9.0
-