Java Code Examples for javax.xml.bind.Marshaller#setAdapter()
The following examples show how to use
javax.xml.bind.Marshaller#setAdapter() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: Jaxb2Marshaller.java From spring-analysis-note with MIT License | 6 votes |
/** * Template method that can be overridden by concrete JAXB marshallers * for custom initialization behavior. Gets called after creation of JAXB * {@code Marshaller}, and after the respective properties have been set. * <p>The default implementation sets the * {@link #setMarshallerProperties defined properties}, the * {@link #setValidationEventHandler validation event handler}, the * {@link #setSchemas schemas}, {@link #setMarshallerListener listener}, * and {@link #setAdapters adapters}. */ protected void initJaxbMarshaller(Marshaller marshaller) throws JAXBException { if (this.marshallerProperties != null) { for (String name : this.marshallerProperties.keySet()) { marshaller.setProperty(name, this.marshallerProperties.get(name)); } } if (this.marshallerListener != null) { marshaller.setListener(this.marshallerListener); } if (this.validationEventHandler != null) { marshaller.setEventHandler(this.validationEventHandler); } if (this.adapters != null) { for (XmlAdapter<?, ?> adapter : this.adapters) { marshaller.setAdapter(adapter); } } if (this.schema != null) { marshaller.setSchema(this.schema); } }
Example 2
Source File: Jaxb2Marshaller.java From java-technology-stack with MIT License | 6 votes |
/** * Template method that can be overridden by concrete JAXB marshallers for custom initialization behavior. * Gets called after creation of JAXB {@code Marshaller}, and after the respective properties have been set. * <p>The default implementation sets the {@link #setMarshallerProperties(Map) defined properties}, the {@link * #setValidationEventHandler(ValidationEventHandler) validation event handler}, the {@link #setSchemas(Resource[]) * schemas}, {@link #setMarshallerListener(javax.xml.bind.Marshaller.Listener) listener}, and * {@link #setAdapters(XmlAdapter[]) adapters}. */ protected void initJaxbMarshaller(Marshaller marshaller) throws JAXBException { if (this.marshallerProperties != null) { for (String name : this.marshallerProperties.keySet()) { marshaller.setProperty(name, this.marshallerProperties.get(name)); } } if (this.marshallerListener != null) { marshaller.setListener(this.marshallerListener); } if (this.validationEventHandler != null) { marshaller.setEventHandler(this.validationEventHandler); } if (this.adapters != null) { for (XmlAdapter<?, ?> adapter : this.adapters) { marshaller.setAdapter(adapter); } } if (this.schema != null) { marshaller.setSchema(this.schema); } }
Example 3
Source File: Jaxb2Marshaller.java From spring4-understanding with Apache License 2.0 | 6 votes |
/** * Template method that can be overridden by concrete JAXB marshallers for custom initialization behavior. * Gets called after creation of JAXB {@code Marshaller}, and after the respective properties have been set. * <p>The default implementation sets the {@link #setMarshallerProperties(Map) defined properties}, the {@link * #setValidationEventHandler(ValidationEventHandler) validation event handler}, the {@link #setSchemas(Resource[]) * schemas}, {@link #setMarshallerListener(javax.xml.bind.Marshaller.Listener) listener}, and * {@link #setAdapters(XmlAdapter[]) adapters}. */ protected void initJaxbMarshaller(Marshaller marshaller) throws JAXBException { if (this.marshallerProperties != null) { for (String name : this.marshallerProperties.keySet()) { marshaller.setProperty(name, this.marshallerProperties.get(name)); } } if (this.marshallerListener != null) { marshaller.setListener(this.marshallerListener); } if (this.validationEventHandler != null) { marshaller.setEventHandler(this.validationEventHandler); } if (this.adapters != null) { for (XmlAdapter<?, ?> adapter : this.adapters) { marshaller.setAdapter(adapter); } } if (this.schema != null) { marshaller.setSchema(this.schema); } }
Example 4
Source File: Jaxb2RootElementHttpMessageConverterTests.java From spring-analysis-note with MIT License | 4 votes |
@Override protected void customizeMarshaller(Marshaller marshaller) { marshaller.setAdapter(new MyCustomElementAdapter()); }
Example 5
Source File: Jaxb2RootElementHttpMessageConverterTests.java From java-technology-stack with MIT License | 4 votes |
@Override protected void customizeMarshaller(Marshaller marshaller) { marshaller.setAdapter(new MyCustomElementAdapter()); }
Example 6
Source File: XmlUtil.java From recheck with GNU Affero General Public License v3.0 | 4 votes |
public static void addLightWeightAdapter( final Marshaller marshaller ) { marshaller.setAdapter( new RenderContainedElementsAdapter( true ) ); marshaller.setAdapter( new StateAttributesAdapter( true ) ); marshaller.setAdapter( new IdentifyingAttributesAdapter( true ) ); }
Example 7
Source File: Jaxb2RootElementHttpMessageConverterTests.java From spring4-understanding with Apache License 2.0 | 4 votes |
@Override protected void customizeMarshaller(Marshaller marshaller) { marshaller.setAdapter(new MyCustomElementAdapter()); }
Example 8
Source File: SC_VerticalCRS.java From sis with Apache License 2.0 | 4 votes |
/** * Replaces the {@code sis-metadata} adapter by this adapter. */ @Override public void register(final Marshaller marshaller) { marshaller.setAdapter(org.apache.sis.internal.jaxb.gml.SC_VerticalCRS.class, this); }