Made FieldNamingStrategy2 and its corresponding builder method package-private.

This commit is contained in:
Inderjeet Singh 2011-04-07 17:41:35 +00:00
parent c15f570c72
commit 4bd261ae06
9 changed files with 7 additions and 17 deletions

View File

@ -214,7 +214,7 @@ public final class FieldAttributes {
}
/**
* @deprecated remove this when {@link FieldNamingStrategy} is deleted.
* remove this when {@link FieldNamingStrategy} is deleted.
*/
@Deprecated
Field getFieldObject() {

View File

@ -26,9 +26,7 @@ import java.lang.reflect.Field;
* @author Inderjeet Singh
* @author Joel Leitch
* @since 1.3
* @deprecated use the {@link FieldNamingStrategy2} instead
*/
@Deprecated
public interface FieldNamingStrategy {
/**

View File

@ -27,7 +27,7 @@ package com.google.gson;
*
* @since 1.7
*/
public interface FieldNamingStrategy2 {
interface FieldNamingStrategy2 {
/**
* Translates the field name into its JSON field name representation.

View File

@ -19,17 +19,16 @@ package com.google.gson;
import com.google.gson.internal.$Gson$Preconditions;
/**
* Adapts the old "deprecated" FieldNamingStrategy to the new {@link FieldNamingStrategy2}
* Adapts the old FieldNamingStrategy to the new {@link FieldNamingStrategy2}
* type.
*
* @author Inderjeet Singh
* @author Joel Leitch
*/
@SuppressWarnings("deprecation")
final class FieldNamingStrategy2Adapter implements FieldNamingStrategy2 {
private final FieldNamingStrategy adaptee;
public FieldNamingStrategy2Adapter(FieldNamingStrategy adaptee) {
FieldNamingStrategy2Adapter(FieldNamingStrategy adaptee) {
this.adaptee = $Gson$Preconditions.checkNotNull(adaptee);
}

View File

@ -319,11 +319,7 @@ public final class GsonBuilder {
* @param fieldNamingStrategy the actual naming strategy to apply to the fields
* @return a reference to this {@code GsonBuilder} object to fulfill the "Builder" pattern
* @since 1.3
* @deprecated convert {@code fieldNamingStrategy} to a implement from
* {@link FieldNamingStrategy2} and call {@link #setFieldNamingStrategy(FieldNamingStrategy2)}
* instead.
*/
@Deprecated
public GsonBuilder setFieldNamingStrategy(FieldNamingStrategy fieldNamingStrategy) {
return setFieldNamingStrategy(new FieldNamingStrategy2Adapter(fieldNamingStrategy));
}
@ -334,9 +330,8 @@ public final class GsonBuilder {
*
* @param fieldNamingStrategy the actual naming strategy to apply to the fields
* @return a reference to this {@code GsonBuilder} object to fulfill the "Builder" pattern
* @since 1.7
*/
public GsonBuilder setFieldNamingStrategy(FieldNamingStrategy2 fieldNamingStrategy) {
GsonBuilder setFieldNamingStrategy(FieldNamingStrategy2 fieldNamingStrategy) {
this.fieldNamingPolicy =
new SerializedNameAnnotationInterceptingNamingPolicy(fieldNamingStrategy);
return this;

View File

@ -40,7 +40,7 @@ abstract class JsonDeserializationVisitor<T> implements ObjectNavigator.Visitor
protected final JsonDeserializationContext context;
protected boolean constructed;
public JsonDeserializationVisitor(JsonElement json, Type targetType,
JsonDeserializationVisitor(JsonElement json, Type targetType,
ObjectNavigator objectNavigator, FieldNamingStrategy2 fieldNamingPolicy,
ObjectConstructor objectConstructor,
ParameterizedTypeHandlerMap<JsonDeserializer<?>> deserializers,

View File

@ -35,7 +35,7 @@ final class SerializedNameAnnotationInterceptingNamingPolicy implements FieldNam
private static final JsonFieldNameValidator fieldNameValidator = new JsonFieldNameValidator();
private final FieldNamingStrategy2 delegate;
public SerializedNameAnnotationInterceptingNamingPolicy(FieldNamingStrategy2 delegate) {
SerializedNameAnnotationInterceptingNamingPolicy(FieldNamingStrategy2 delegate) {
this.delegate = delegate;
}

View File

@ -37,7 +37,6 @@ public class FieldNamingStrategy2AdapterTest extends TestCase {
new FieldAttributes(String.class, field, String.class)));
}
@SuppressWarnings("deprecation")
private static class UpperCaseNamingStrategy implements FieldNamingStrategy {
public String translateName(Field f) {
return f.getName().toUpperCase();

View File

@ -33,7 +33,6 @@ import junit.framework.TestCase;
* @author Inderjeet Singh
* @author Joel Leitch
*/
@SuppressWarnings("deprecation")
public class NamingPolicyTest extends TestCase {
private GsonBuilder builder;