提交 3740380a 编写于 作者: J Juergen Hoeller

polishing

上级 cb434793
/**
*
* <p>
* SPI to implement Converters.
* </p>
* SPI to implement Converters for the type conversion system.
*
*/
package org.springframework.core.convert.converter;
......
/**
*
* <p>
* Type conversion system API.
* </p>
*
*/
package org.springframework.core.convert;
......
/**
*
* <p>
* TypeConverter system implementation.
* </p>
* Default implementation of the type conversion system.
*
*/
package org.springframework.core.convert.support;
......
/*
* Copyright 2002-2009 the original author or authors.
* Copyright 2002-2010 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
......@@ -76,7 +76,7 @@ public class MarshallingMessageConverter implements MessageConverter, Initializi
* {@link Unmarshaller} interface as well
*/
public MarshallingMessageConverter(Marshaller marshaller) {
Assert.notNull(marshaller, "marshaller must not be null");
Assert.notNull(marshaller, "Marshaller must not be null");
if (!(marshaller instanceof Unmarshaller)) {
throw new IllegalArgumentException(
"Marshaller [" + marshaller + "] does not implement the Unmarshaller " +
......@@ -96,8 +96,8 @@ public class MarshallingMessageConverter implements MessageConverter, Initializi
* @param unmarshaller the Unmarshaller to use
*/
public MarshallingMessageConverter(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;
}
......
......@@ -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.
*/
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册