diff --git a/spring-context/src/main/java/org/springframework/format/annotation/NumberFormat.java b/spring-context/src/main/java/org/springframework/format/annotation/NumberFormat.java index e4f1076ea7..0eea0622ac 100644 --- a/spring-context/src/main/java/org/springframework/format/annotation/NumberFormat.java +++ b/spring-context/src/main/java/org/springframework/format/annotation/NumberFormat.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2014 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. @@ -25,13 +25,14 @@ import java.lang.annotation.Target; * Declares that a field should be formatted as a number. * Supports formatting by style or custom pattern string. * Can be applied to any JDK {@code java.lang.Number} type. - *
- * For style-based formatting, set the {@link #style()} attribute to be the desired {@link Style}. + * + *
For style-based formatting, set the {@link #style()} attribute to be the desired {@link Style}. * For custom formatting, set the {@link #pattern()} attribute to be the number pattern, such as {@code #, ###.##}. - *
- * Each attribute is mutually exclusive, so only set one attribute per annotation instance (the one most convenient one for your formatting needs). - * When the pattern attribute is specified, it takes precedence over the style attribute. - * When no annotation attributes are specified, the default format applied is style-based with a style of {@link Style#NUMBER}. + * + *
Each attribute is mutually exclusive, so only set one attribute per annotation instance + * (the one most convenient one for your formatting needs). When the pattern attribute is specified, + * it takes precedence over the style attribute. When no annotation attributes are specified, + * the default format applied is style-based with a style of {@link Style#NUMBER}. * * @author Keith Donald * @since 3.0 @@ -43,23 +44,23 @@ public @interface NumberFormat { /** * The style pattern to use to format the field. - * Defaults to {@link Style#NUMBER} for general-purpose number formatter. - * Set this attribute when you wish to format your field in accordance with a common style other than the default style. + *
Defaults to {@link Style#NUMBER} for general-purpose number formatter. + * Set this attribute when you wish to format your field in accordance with a + * common style other than the default style. */ Style style() default Style.NUMBER; /** * The custom pattern to use to format the field. - * Defaults to empty String, indicating no custom pattern String has been specified. - * Set this attribute when you wish to format your field in accordance with a custom number pattern not represented by a style. + *
Defaults to empty String, indicating no custom pattern String has been specified. + * Set this attribute when you wish to format your field in accordance with a + * custom number pattern not represented by a style. */ String pattern() default ""; /** * Common number format styles. - * @author Keith Donald - * @since 3.0 */ public enum Style { diff --git a/spring-web/src/main/java/org/springframework/http/converter/json/GsonBase64ByteArrayJsonTypeAdapter.java b/spring-web/src/main/java/org/springframework/http/converter/json/GsonBase64ByteArrayJsonTypeAdapter.java index 54212f480a..d3c342797b 100644 --- a/spring-web/src/main/java/org/springframework/http/converter/json/GsonBase64ByteArrayJsonTypeAdapter.java +++ b/spring-web/src/main/java/org/springframework/http/converter/json/GsonBase64ByteArrayJsonTypeAdapter.java @@ -19,32 +19,30 @@ package org.springframework.http.converter.json; import java.lang.reflect.Type; import java.nio.charset.Charset; -import org.apache.commons.codec.binary.Base64; - import com.google.gson.GsonBuilder; import com.google.gson.JsonDeserializationContext; import com.google.gson.JsonDeserializer; import com.google.gson.JsonElement; -import com.google.gson.JsonParseException; import com.google.gson.JsonPrimitive; import com.google.gson.JsonSerializationContext; import com.google.gson.JsonSerializer; import com.google.gson.TypeAdapter; +import org.apache.commons.codec.binary.Base64; /** - * Custom Gson {@link TypeAdapter} for serialization or deserialization of - * {@code byte[]}. By default Gson converts byte arrays to JSON arrays instead - * of a Base64 encoded string. Use this type adapter with - * {@link org.springframework.http.converter.json.GsonHttpMessageConverter - * GsonHttpMessageConverter} to read and write Base64 encoded byte arrays. + * Custom Gson {@link TypeAdapter} for serialization and deserialization + * of {@code byte[]} values to/from Base64-encoded Strings. + * + *
By default, Gson converts byte arrays to JSON arrays. This type adapter
+ * needs to be specifically registered to read/write Base64-encoded byte arrays.
*
* @author Roy Clarkson
* @since 4.1
* @see GsonBuilder#registerTypeHierarchyAdapter(Class, Object)
*/
-final class GsonBase64ByteArrayJsonTypeAdapter implements JsonSerializer This converter can be used to bind to typed beans or untyped
- * {@link java.util.HashMap HashMap} instances.
- *
- * By default this converter supports {@code application/json} and
- * {@code application/*+json} but {@link #setSupportedMediaTypes
- * supportedMediaTypes} can be used to change that.
+ * This converter can be used to bind to typed beans or untyped {@code HashMap}s.
+ * By default, it supports {@code application/json} and {@code application/*+json}.
*
* Tested against Gson 2.2; compatible with Gson 2.0 and higher.
*
* @author Roy Clarkson
* @since 4.1
+ * @see #setGson
+ * @see #setSupportedMediaTypes
*/
public class GsonHttpMessageConverter extends AbstractHttpMessageConverter