polishing
This commit is contained in:
@@ -31,15 +31,15 @@ import org.springframework.oxm.UnmarshallingFailureException;
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
/**
|
||||
* Implementation of {@link org.springframework.http.converter.HttpMessageConverter HttpMessageConverter} that can read
|
||||
* and write XML using Spring's {@link Marshaller} and {@link Unmarshaller} abstractions.
|
||||
* Implementation of {@link org.springframework.http.converter.HttpMessageConverter HttpMessageConverter}
|
||||
* that can read and write XML using Spring's {@link Marshaller} and {@link Unmarshaller} abstractions.
|
||||
*
|
||||
* <p>This converter requires a {@code Marshaller} and {@code Unmarshaller} before it can be used. These can be injected
|
||||
* by the {@linkplain #MarshallingHttpMessageConverter(Marshaller) constructor} or {@linkplain
|
||||
* #setMarshaller(Marshaller) bean properties}.
|
||||
* <p>This converter requires a {@code Marshaller} and {@code Unmarshaller} before it can be used.
|
||||
* These can be injected by the {@linkplain #MarshallingHttpMessageConverter(Marshaller) constructor}
|
||||
* or {@linkplain #setMarshaller(Marshaller) bean properties}.
|
||||
*
|
||||
* <p>By default, this converter supports {@code text/xml} and {@code application/xml}. This can be overridden by
|
||||
* setting the {@link #setSupportedMediaTypes(java.util.List) supportedMediaTypes} property.
|
||||
* <p>By default, this converter supports {@code text/xml} and {@code application/xml}. This can be
|
||||
* overridden by setting the {@link #setSupportedMediaTypes(java.util.List) supportedMediaTypes} property.
|
||||
*
|
||||
* @author Arjen Poutsma
|
||||
* @since 3.0
|
||||
@@ -52,22 +52,23 @@ public class MarshallingHttpMessageConverter extends AbstractXmlHttpMessageConve
|
||||
|
||||
|
||||
/**
|
||||
* Construct a new {@code MarshallingHttpMessageConverter} with no {@link Marshaller} or {@link Unmarshaller} set. The
|
||||
* marshaller and unmarshaller must be set after construction by invoking {@link #setMarshaller(Marshaller)} and {@link
|
||||
* #setUnmarshaller(Unmarshaller)} .
|
||||
* Construct a new {@code MarshallingHttpMessageConverter} with no {@link Marshaller} or
|
||||
* {@link Unmarshaller} set. The Marshaller and Unmarshaller must be set after construction
|
||||
* by invoking {@link #setMarshaller(Marshaller)} and {@link #setUnmarshaller(Unmarshaller)} .
|
||||
*/
|
||||
public MarshallingHttpMessageConverter() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Construct a new {@code MarshallingMessageConverter} with the given {@link Marshaller} set. <p>If the given {@link
|
||||
* Marshaller} also implements the {@link Unmarshaller} interface, it is used for both marshalling and unmarshalling.
|
||||
* Otherwise, an exception is thrown. <p>Note that all {@code Marshaller} implementations in Spring also implement the
|
||||
* Construct a new {@code MarshallingMessageConverter} with the given {@link Marshaller} set.
|
||||
* <p>If the given {@link Marshaller} also implements the {@link Unmarshaller} interface,
|
||||
* it is used for both marshalling and unmarshalling. Otherwise, an exception is thrown.
|
||||
* <p>Note that all {@code Marshaller} implementations in Spring also implement the
|
||||
* {@code Unmarshaller} interface, so that you can safely use this constructor.
|
||||
* @param marshaller object used as marshaller and unmarshaller
|
||||
*/
|
||||
public MarshallingHttpMessageConverter(Marshaller marshaller) {
|
||||
Assert.notNull(marshaller, "marshaller must not be null");
|
||||
Assert.notNull(marshaller, "Marshaller must not be null");
|
||||
this.marshaller = marshaller;
|
||||
if (marshaller instanceof Unmarshaller) {
|
||||
this.unmarshaller = (Unmarshaller) marshaller;
|
||||
@@ -75,18 +76,19 @@ public class MarshallingHttpMessageConverter extends AbstractXmlHttpMessageConve
|
||||
}
|
||||
|
||||
/**
|
||||
* Construct a new <code>MarshallingMessageConverter</code> with the given {@code Marshaller} and {@code
|
||||
* Unmarshaller}.
|
||||
* Construct a new <code>MarshallingMessageConverter</code> with the given
|
||||
* {@code Marshaller} and {@code Unmarshaller}.
|
||||
* @param marshaller the Marshaller to use
|
||||
* @param unmarshaller the Unmarshaller to use
|
||||
*/
|
||||
public MarshallingHttpMessageConverter(Marshaller marshaller, Unmarshaller unmarshaller) {
|
||||
Assert.notNull(marshaller, "marshaller must not be null");
|
||||
Assert.notNull(unmarshaller, "unmarshaller must not be null");
|
||||
Assert.notNull(marshaller, "Marshaller must not be null");
|
||||
Assert.notNull(unmarshaller, "Unmarshaller must not be null");
|
||||
this.marshaller = marshaller;
|
||||
this.unmarshaller = unmarshaller;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Set the {@link Marshaller} to be used by this message converter.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user