![]() |
![]() |
com.google.gson_1.6.0.v20110113153016:34:26.198 INFO jd.cli.Main - Decompiling com.google.gson_1.6.0.v201101131530.jar package com.google.gson; final class AnonymousAndLocalClassExclusionStrategy implements ExclusionStrategy { public boolean shouldSkipField(FieldAttributes f) { return isAnonymousOrLocal(f.getDeclaredClass()); } public boolean shouldSkipClass(Class<?> clazz) { return isAnonymousOrLocal(clazz); } private boolean isAnonymousOrLocal(Class<?> clazz) { return (!Enum.class.isAssignableFrom(clazz)) && ((clazz.isAnonymousClass()) || (clazz.isLocalClass())); } } /* Location: * Qualified Name: com.google.gson.AnonymousAndLocalClassExclusionStrategy * Java Class Version: 5 (49.0) * JD-Core Version: 0.7.1 */ package com.google.gson; abstract interface Cache<K, V> { public abstract void addElement(K paramK, V paramV); public abstract V getElement(K paramK); public abstract V removeElement(K paramK); public abstract void clear(); public abstract int size(); } /* Location: * Qualified Name: com.google.gson.Cache * Java Class Version: 5 (49.0) * JD-Core Version: 0.7.1 */ package com.google.gson; import java.lang.annotation.Annotation; import java.lang.reflect.Type; import java.util.Collection; final class CamelCaseSeparatorNamingPolicy extends RecursiveFieldNamingPolicy { private final String separatorString; public CamelCaseSeparatorNamingPolicy(String separatorString) { Preconditions.checkNotNull(separatorString); Preconditions.checkArgument(!"".equals(separatorString)); this.separatorString = separatorString; } protected String translateName(String target, Type fieldType, Collection<Annotation> annnotations) { StringBuilder translation = new StringBuilder(); for (int i = 0; i < target.length(); i++) { char character = target.charAt(i); if ((Character.isUpperCase(character)) && (translation.length() != 0)) { translation.append(separatorString); } translation.append(character); } return translation.toString(); } } /* Location: * Qualified Name: com.google.gson.CamelCaseSeparatorNamingPolicy * Java Class Version: 5 (49.0) * JD-Core Version: 0.7.1 */ package com.google.gson; final class CircularReferenceException extends RuntimeException { private static final long serialVersionUID = 7444343294106513081L; private final Object offendingNode; CircularReferenceException(Object offendingNode) { super("circular reference error"); this.offendingNode = offendingNode; } public IllegalStateException createDetailedException(FieldAttributes offendingField) { StringBuilder msg = new StringBuilder(getMessage()); if (offendingField != null) { msg.append("\n ").append("Offending field: ").append(offendingField.getName() + "\n"); } if (offendingNode != null) { msg.append("\n ").append("Offending object: ").append(offendingNode); } return new IllegalStateException(msg.toString(), this); } } /* Location: * Qualified Name: com.google.gson.CircularReferenceException * Java Class Version: 5 (49.0) * JD-Core Version: 0.7.1 */ package com.google.gson; import java.lang.annotation.Annotation; import java.lang.reflect.Type; import java.util.Collection; abstract class CompositionFieldNamingPolicy extends RecursiveFieldNamingPolicy { private final RecursiveFieldNamingPolicy[] fieldPolicies; public CompositionFieldNamingPolicy(RecursiveFieldNamingPolicy... fieldNamingPolicies) { if (fieldNamingPolicies == null) { throw new NullPointerException("naming policies can not be null."); } fieldPolicies = fieldNamingPolicies; } protected String translateName(String target, Type fieldType, Collection<Annotation> annotations) { for (RecursiveFieldNamingPolicy policy : fieldPolicies) { target = policy.translateName(target, fieldType, annotations); } return target; } } /* Location: * Qualified Name: com.google.gson.CompositionFieldNamingPolicy * Java Class Version: 5 (49.0) * JD-Core Version: 0.7.1 */ package com.google.gson; class DefaultTypeAdapters$1 {} /* Location: * Qualified Name: com.google.gson.DefaultTypeAdapters.1 * Java Class Version: 5 (49.0) * JD-Core Version: 0.7.1 */ package com.google.gson; import java.lang.reflect.Type; import java.math.BigDecimal; class DefaultTypeAdapters$BigDecimalTypeAdapter implements JsonSerializer<BigDecimal>, JsonDeserializer<BigDecimal> { public JsonElement serialize(BigDecimal src, Type typeOfSrc, JsonSerializationContext context) { return new JsonPrimitive(src); } public BigDecimal deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) throws JsonParseException { return json.getAsBigDecimal(); } public String toString() { return BigDecimalTypeAdapter.class.getSimpleName(); } } /* Location: * Qualified Name: com.google.gson.DefaultTypeAdapters.BigDecimalTypeAdapter * Java Class Version: 5 (49.0) * JD-Core Version: 0.7.1 */ package com.google.gson; import java.lang.reflect.Type; import java.math.BigInteger; class DefaultTypeAdapters$BigIntegerTypeAdapter implements JsonSerializer<BigInteger>, JsonDeserializer<BigInteger> { public JsonElement serialize(BigInteger src, Type typeOfSrc, JsonSerializationContext context) { return new JsonPrimitive(src); } public BigInteger deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) throws JsonParseException { return json.getAsBigInteger(); } public String toString() { return BigIntegerTypeAdapter.class.getSimpleName(); } } /* Location: * Qualified Name: com.google.gson.DefaultTypeAdapters.BigIntegerTypeAdapter * Java Class Version: 5 (49.0) * JD-Core Version: 0.7.1 */ package com.google.gson; import java.lang.reflect.Type; class DefaultTypeAdapters$BooleanTypeAdapter implements JsonSerializer<Boolean>, JsonDeserializer<Boolean> { public JsonElement serialize(Boolean src, Type typeOfSrc, JsonSerializationContext context) { return new JsonPrimitive(src); } public Boolean deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) throws JsonParseException { return Boolean.valueOf(json.getAsBoolean()); } public String toString() { return BooleanTypeAdapter.class.getSimpleName(); } } /* Location: * Qualified Name: com.google.gson.DefaultTypeAdapters.BooleanTypeAdapter * Java Class Version: 5 (49.0) * JD-Core Version: 0.7.1 */ package com.google.gson; import java.lang.reflect.Type; class DefaultTypeAdapters$ByteTypeAdapter implements JsonSerializer<Byte>, JsonDeserializer<Byte> { public JsonElement serialize(Byte src, Type typeOfSrc, JsonSerializationContext context) { return new JsonPrimitive(src); } public Byte deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) throws JsonParseException { return Byte.valueOf(json.getAsByte()); } public String toString() { return ByteTypeAdapter.class.getSimpleName(); } } /* Location: * Qualified Name: com.google.gson.DefaultTypeAdapters.ByteTypeAdapter * Java Class Version: 5 (49.0) * JD-Core Version: 0.7.1 */ package com.google.gson; import java.lang.reflect.Type; class DefaultTypeAdapters$CharacterTypeAdapter implements JsonSerializer<Character>, JsonDeserializer<Character> { public JsonElement serialize(Character src, Type typeOfSrc, JsonSerializationContext context) { return new JsonPrimitive(src); } public Character deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) throws JsonParseException { return Character.valueOf(json.getAsCharacter()); } public String toString() { return CharacterTypeAdapter.class.getSimpleName(); } } /* Location: * Qualified Name: com.google.gson.DefaultTypeAdapters.CharacterTypeAdapter * Java Class Version: 5 (49.0) * JD-Core Version: 0.7.1 */ package com.google.gson; import java.lang.reflect.ParameterizedType; import java.lang.reflect.Type; import java.util.Collection; import java.util.LinkedList; class DefaultTypeAdapters$CollectionTypeAdapter implements JsonSerializer<Collection>, JsonDeserializer<Collection>, InstanceCreator<Collection> { public JsonElement serialize(Collection src, Type typeOfSrc, JsonSerializationContext context) { if (src == null) { return JsonNull.createJsonNull(); } JsonArray array = new JsonArray(); Type childGenericType = null; if ((typeOfSrc instanceof ParameterizedType)) { childGenericType = new TypeInfoCollection(typeOfSrc).getElementType(); } for (Object child : src) { if (child == null) { array.add(JsonNull.createJsonNull()); } else { Type childType = (childGenericType == null) || (childGenericType == Object.class) ? child.getClass() : childGenericType; JsonElement element = context.serialize(child, childType); array.add(element); } } return array; } public Collection deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) throws JsonParseException { if (json.isJsonNull()) { return null; } Collection collection = constructCollectionType(typeOfT, context); Type childType = new TypeInfoCollection(typeOfT).getElementType(); for (JsonElement childElement : json.getAsJsonArray()) { if ((childElement == null) || (childElement.isJsonNull())) { collection.add(null); } else { Object value = context.deserialize(childElement, childType); collection.add(value); } } return collection; } private Collection constructCollectionType(Type collectionType, JsonDeserializationContext context) { JsonDeserializationContextDefault contextImpl = (JsonDeserializationContextDefault)context; ObjectConstructor objectConstructor = contextImpl.getObjectConstructor(); return (Collection)objectConstructor.construct(collectionType); } public Collection createInstance(Type type) { return new LinkedList(); } } /* Location: * Qualified Name: com.google.gson.DefaultTypeAdapters.CollectionTypeAdapter * Java Class Version: 5 (49.0) * JD-Core Version: 0.7.1 */ package com.google.gson; import java.lang.reflect.Type; import java.text.DateFormat; import java.text.SimpleDateFormat; import java.util.Date; class DefaultTypeAdapters$DefaultDateTypeAdapter implements JsonSerializer<Date>, JsonDeserializer<Date> { private final DateFormat format; DefaultTypeAdapters$DefaultDateTypeAdapter() { format = DateFormat.getDateTimeInstance(); } DefaultTypeAdapters$DefaultDateTypeAdapter(String datePattern) { format = new SimpleDateFormat(datePattern); } DefaultTypeAdapters$DefaultDateTypeAdapter(int style) { format = DateFormat.getDateInstance(style); } public DefaultTypeAdapters$DefaultDateTypeAdapter(int dateStyle, int timeStyle) { format = DateFormat.getDateTimeInstance(dateStyle, timeStyle); } public JsonElement serialize(Date src, Type typeOfSrc, JsonSerializationContext context) { synchronized (format) { String dateFormatAsString = format.format(src); return new JsonPrimitive(dateFormatAsString); } } /* Error */ public Date deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) throws JsonParseException { // Byte code: // 0: aload_1 // 1: instanceof 55 // 4: ifne +13 -> 17 // 7: new 54 com/google/gson/JsonParseException // 10: dup // 11: ldc 1 // 13: invokespecial 113 com/google/gson/JsonParseException:<init> (Ljava/lang/String;)V // 16: athrow // 17: aload_0 // 18: getfield 109 com/google/gson/DefaultTypeAdapters$DefaultDateTypeAdapter:format Ljava/text/DateFormat; // 21: dup // 22: astore 4 // 24: monitorenter // 25: aload_0 // 26: getfield 109 com/google/gson/DefaultTypeAdapters$DefaultDateTypeAdapter:format Ljava/text/DateFormat; // 29: aload_1 // 30: invokevirtual 112 com/google/gson/JsonElement:getAsString ()Ljava/lang/String; // 33: invokevirtual 127 java/text/DateFormat:parse (Ljava/lang/String;)Ljava/util/Date; // 36: aload 4 // 38: monitorexit // 39: areturn // 40: astore 5 // 42: aload 4 // 44: monitorexit // 45: aload 5 // 47: athrow // 48: astore 4 // 50: new 57 com/google/gson/JsonSyntaxException // 53: dup // 54: aload 4 // 56: invokespecial 115 com/google/gson/JsonSyntaxException:<init> (Ljava/lang/Throwable;)V // 59: athrow // Line number table: // Java source line #273 -> byte code offset #0 // Java source line #274 -> byte code offset #7 // Java source line #277 -> byte code offset #17 // Java source line #278 -> byte code offset #25 // Java source line #279 -> byte code offset #40 // Java source line #280 -> byte code offset #48 // Java source line #281 -> byte code offset #50 // Local variable table: // start length slot name signature // 0 60 0 this DefaultDateTypeAdapter // 0 60 1 json JsonElement // 0 60 2 typeOfT Type // 0 60 3 context JsonDeserializationContext // 22 21 4 Ljava/lang/Object; Object // 48 7 4 e java.text.ParseException // 40 6 5 localObject1 Object // Exception table: // from to target type // 25 39 40 finally // 40 45 40 finally // 17 39 48 java/text/ParseException // 40 48 48 java/text/ParseException } public String toString() { StringBuilder sb = new StringBuilder(); sb.append(DefaultDateTypeAdapter.class.getSimpleName()); sb.append('(').append(format.getClass().getSimpleName()).append(')'); return sb.toString(); } } /* Location: * Qualified Name: com.google.gson.DefaultTypeAdapters.DefaultDateTypeAdapter * Java Class Version: 5 (49.0) * JD-Core Version: 0.7.1 */ package com.google.gson; import java.lang.reflect.Type; import java.sql.Date; import java.text.DateFormat; import java.text.SimpleDateFormat; class DefaultTypeAdapters$DefaultJavaSqlDateTypeAdapter implements JsonSerializer<Date>, JsonDeserializer<Date> { private final DateFormat format; DefaultTypeAdapters$DefaultJavaSqlDateTypeAdapter() { format = new SimpleDateFormat("MMM d, yyyy"); } public JsonElement serialize(Date src, Type typeOfSrc, JsonSerializationContext context) { synchronized (format) { String dateFormatAsString = format.format(src); return new JsonPrimitive(dateFormatAsString); } } /* Error */ public Date deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) throws JsonParseException { // Byte code: // 0: aload_1 // 1: instanceof 46 // 4: ifne +13 -> 17 // 7: new 45 com/google/gson/JsonParseException // 10: dup // 11: ldc 2 // 13: invokespecial 91 com/google/gson/JsonParseException:<init> (Ljava/lang/String;)V // 16: athrow // 17: aload_0 // 18: getfield 87 com/google/gson/DefaultTypeAdapters$DefaultJavaSqlDateTypeAdapter:format Ljava/text/DateFormat; // 21: dup // 22: astore 4 // 24: monitorenter // 25: aload_0 // 26: getfield 87 com/google/gson/DefaultTypeAdapters$DefaultJavaSqlDateTypeAdapter:format Ljava/text/DateFormat; // 29: aload_1 // 30: invokevirtual 90 com/google/gson/JsonElement:getAsString ()Ljava/lang/String; // 33: invokevirtual 97 java/text/DateFormat:parse (Ljava/lang/String;)Ljava/util/Date; // 36: astore 5 // 38: new 50 java/sql/Date // 41: dup // 42: aload 5 // 44: invokevirtual 99 java/util/Date:getTime ()J // 47: invokespecial 95 java/sql/Date:<init> (J)V // 50: aload 4 // 52: monitorexit // 53: areturn // 54: astore 6 // 56: aload 4 // 58: monitorexit // 59: aload 6 // 61: athrow // 62: astore 4 // 64: new 48 com/google/gson/JsonSyntaxException // 67: dup // 68: aload 4 // 70: invokespecial 93 com/google/gson/JsonSyntaxException:<init> (Ljava/lang/Throwable;)V // 73: athrow // Line number table: // Java source line #311 -> byte code offset #0 // Java source line #312 -> byte code offset #7 // Java source line #315 -> byte code offset #17 // Java source line #316 -> byte code offset #25 // Java source line #317 -> byte code offset #38 // Java source line #318 -> byte code offset #54 // Java source line #319 -> byte code offset #62 // Java source line #320 -> byte code offset #64 // Local variable table: // start length slot name signature // 0 74 0 this DefaultJavaSqlDateTypeAdapter // 0 74 1 json JsonElement // 0 74 2 typeOfT Type // 0 74 3 context JsonDeserializationContext // 62 7 4 e java.text.ParseException // 36 7 5 date java.util.Date // 54 6 6 localObject1 Object // Exception table: // from to target type // 25 53 54 finally // 54 59 54 finally // 17 53 62 java/text/ParseException // 54 62 62 java/text/ParseException } } /* Location: * Qualified Name: com.google.gson.DefaultTypeAdapters.DefaultJavaSqlDateTypeAdapter * Java Class Version: 5 (49.0) * JD-Core Version: 0.7.1 */ package com.google.gson; import java.lang.reflect.Type; import java.sql.Time; import java.text.DateFormat; import java.text.SimpleDateFormat; class DefaultTypeAdapters$DefaultTimeTypeAdapter implements JsonSerializer<Time>, JsonDeserializer<Time> { private final DateFormat format; DefaultTypeAdapters$DefaultTimeTypeAdapter() { format = new SimpleDateFormat("hh:mm:ss a"); } public JsonElement serialize(Time src, Type typeOfSrc, JsonSerializationContext context) { synchronized (format) { String dateFormatAsString = format.format(src); return new JsonPrimitive(dateFormatAsString); } } /* Error */ public Time deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) throws JsonParseException { // Byte code: // 0: aload_1 // 1: instanceof 46 // 4: ifne +13 -> 17 // 7: new 45 com/google/gson/JsonParseException // 10: dup // 11: ldc 1 // 13: invokespecial 91 com/google/gson/JsonParseException:<init> (Ljava/lang/String;)V // 16: athrow // 17: aload_0 // 18: getfield 87 com/google/gson/DefaultTypeAdapters$DefaultTimeTypeAdapter:format Ljava/text/DateFormat; // 21: dup // 22: astore 4 // 24: monitorenter // 25: aload_0 // 26: getfield 87 com/google/gson/DefaultTypeAdapters$DefaultTimeTypeAdapter:format Ljava/text/DateFormat; // 29: aload_1 // 30: invokevirtual 90 com/google/gson/JsonElement:getAsString ()Ljava/lang/String; // 33: invokevirtual 97 java/text/DateFormat:parse (Ljava/lang/String;)Ljava/util/Date; // 36: astore 5 // 38: new 50 java/sql/Time // 41: dup // 42: aload 5 // 44: invokevirtual 99 java/util/Date:getTime ()J // 47: invokespecial 95 java/sql/Time:<init> (J)V // 50: aload 4 // 52: monitorexit // 53: areturn // 54: astore 6 // 56: aload 4 // 58: monitorexit // 59: aload 6 // 61: athrow // 62: astore 4 // 64: new 48 com/google/gson/JsonSyntaxException // 67: dup // 68: aload 4 // 70: invokespecial 93 com/google/gson/JsonSyntaxException:<init> (Ljava/lang/Throwable;)V // 73: athrow // Line number table: // Java source line #346 -> byte code offset #0 // Java source line #347 -> byte code offset #7 // Java source line #350 -> byte code offset #17 // Java source line #351 -> byte code offset #25 // Java source line #352 -> byte code offset #38 // Java source line #353 -> byte code offset #54 // Java source line #354 -> byte code offset #62 // Java source line #355 -> byte code offset #64 // Local variable table: // start length slot name signature // 0 74 0 this DefaultTimeTypeAdapter // 0 74 1 json JsonElement // 0 74 2 typeOfT Type // 0 74 3 context JsonDeserializationContext // 62 7 4 e java.text.ParseException // 36 7 5 date java.util.Date // 54 6 6 localObject1 Object // Exception table: // from to target type // 25 53 54 finally // 54 59 54 finally // 17 53 62 java/text/ParseException // 54 62 62 java/text/ParseException } } /* Location: * Qualified Name: com.google.gson.DefaultTypeAdapters.DefaultTimeTypeAdapter * Java Class Version: 5 (49.0) * JD-Core Version: 0.7.1 */ package com.google.gson; import java.lang.reflect.Type; import java.sql.Timestamp; import java.util.Date; class DefaultTypeAdapters$DefaultTimestampDeserializer implements JsonDeserializer<Timestamp> { public Timestamp deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) throws JsonParseException { Date date = (Date)context.deserialize(json, Date.class); return new Timestamp(date.getTime()); } } /* Location: * Qualified Name: com.google.gson.DefaultTypeAdapters.DefaultTimestampDeserializer * Java Class Version: 5 (49.0) * JD-Core Version: 0.7.1 */ package com.google.gson; import java.lang.reflect.Type; class DefaultTypeAdapters$DoubleDeserializer implements JsonDeserializer<Double> { public Double deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) throws JsonParseException { return Double.valueOf(json.getAsDouble()); } public String toString() { return DoubleDeserializer.class.getSimpleName(); } } /* Location: * Qualified Name: com.google.gson.DefaultTypeAdapters.DoubleDeserializer * Java Class Version: 5 (49.0) * JD-Core Version: 0.7.1 */ package com.google.gson; import java.lang.reflect.Type; class DefaultTypeAdapters$DoubleSerializer implements JsonSerializer<Double> { private final boolean serializeSpecialFloatingPointValues; DefaultTypeAdapters$DoubleSerializer(boolean serializeSpecialDoubleValues) { serializeSpecialFloatingPointValues = serializeSpecialDoubleValues; } public JsonElement serialize(Double src, Type typeOfSrc, JsonSerializationContext context) { if ((!serializeSpecialFloatingPointValues) && ( (Double.isNaN(src.doubleValue())) || (Double.isInfinite(src.doubleValue())))) { throw new IllegalArgumentException(src + " is not a valid double value as per JSON specification. To override this" + " behavior, use GsonBuilder.serializeSpecialDoubleValues() method."); } return new JsonPrimitive(src); } } /* Location: * Qualified Name: com.google.gson.DefaultTypeAdapters.DoubleSerializer * Java Class Version: 5 (49.0) * JD-Core Version: 0.7.1 */ package com.google.gson; import java.lang.reflect.Type; class DefaultTypeAdapters$EnumTypeAdapter<T extends Enum<T>> implements JsonSerializer<T>, JsonDeserializer<T> { public JsonElement serialize(T src, Type typeOfSrc, JsonSerializationContext context) { return new JsonPrimitive(src.name()); } public T deserialize(JsonElement json, Type classOfT, JsonDeserializationContext context) throws JsonParseException { return Enum.valueOf((Class)classOfT, json.getAsString()); } public String toString() { return EnumTypeAdapter.class.getSimpleName(); } } /* Location: * Qualified Name: com.google.gson.DefaultTypeAdapters.EnumTypeAdapter * Java Class Version: 5 (49.0) * JD-Core Version: 0.7.1 */ package com.google.gson; import java.lang.reflect.Type; class DefaultTypeAdapters$FloatDeserializer implements JsonDeserializer<Float> { public Float deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) throws JsonParseException { return Float.valueOf(json.getAsFloat()); } public String toString() { return FloatDeserializer.class.getSimpleName(); } } /* Location: * Qualified Name: com.google.gson.DefaultTypeAdapters.FloatDeserializer * Java Class Version: 5 (49.0) * JD-Core Version: 0.7.1 */ package com.google.gson; import java.lang.reflect.Type; class DefaultTypeAdapters$FloatSerializer implements JsonSerializer<Float> { private final boolean serializeSpecialFloatingPointValues; DefaultTypeAdapters$FloatSerializer(boolean serializeSpecialDoubleValues) { serializeSpecialFloatingPointValues = serializeSpecialDoubleValues; } public JsonElement serialize(Float src, Type typeOfSrc, JsonSerializationContext context) { if ((!serializeSpecialFloatingPointValues) && ( (Float.isNaN(src.floatValue())) || (Float.isInfinite(src.floatValue())))) { throw new IllegalArgumentException(src + " is not a valid float value as per JSON specification. To override this" + " behavior, use GsonBuilder.serializeSpecialFloatingPointValues() method."); } return new JsonPrimitive(src); } } /* Location: * Qualified Name: com.google.gson.DefaultTypeAdapters.FloatSerializer * Java Class Version: 5 (49.0) * JD-Core Version: 0.7.1 */ package com.google.gson; import java.lang.reflect.Type; import java.util.GregorianCalendar; class DefaultTypeAdapters$GregorianCalendarTypeAdapter implements JsonSerializer<GregorianCalendar>, JsonDeserializer<GregorianCalendar> { private static final String YEAR = "year"; private static final String MONTH = "month"; private static final String DAY_OF_MONTH = "dayOfMonth"; private static final String HOUR_OF_DAY = "hourOfDay"; private static final String MINUTE = "minute"; private static final String SECOND = "second"; public JsonElement serialize(GregorianCalendar src, Type typeOfSrc, JsonSerializationContext context) { JsonObject obj = new JsonObject(); obj.addProperty("year", Integer.valueOf(src.get(1))); obj.addProperty("month", Integer.valueOf(src.get(2))); obj.addProperty("dayOfMonth", Integer.valueOf(src.get(5))); obj.addProperty("hourOfDay", Integer.valueOf(src.get(11))); obj.addProperty("minute", Integer.valueOf(src.get(12))); obj.addProperty("second", Integer.valueOf(src.get(13))); return obj; } public GregorianCalendar deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) throws JsonParseException { JsonObject obj = json.getAsJsonObject(); int year = obj.get("year").getAsInt(); int month = obj.get("month").getAsInt(); int dayOfMonth = obj.get("dayOfMonth").getAsInt(); int hourOfDay = obj.get("hourOfDay").getAsInt(); int minute = obj.get("minute").getAsInt(); int second = obj.get("second").getAsInt(); return new GregorianCalendar(year, month, dayOfMonth, hourOfDay, minute, second); } public String toString() { return GregorianCalendarTypeAdapter.class.getSimpleName(); } } /* Location: * Qualified Name: com.google.gson.DefaultTypeAdapters.GregorianCalendarTypeAdapter * Java Class Version: 5 (49.0) * JD-Core Version: 0.7.1 */ package com.google.gson; import java.lang.reflect.Type; import java.util.HashSet; class DefaultTypeAdapters$HashSetCreator implements InstanceCreator<HashSet<?>> { public HashSet<?> createInstance(Type type) { return new HashSet(); } public String toString() { return HashSetCreator.class.getSimpleName(); } } /* Location: * Qualified Name: com.google.gson.DefaultTypeAdapters.HashSetCreator * Java Class Version: 5 (49.0) * JD-Core Version: 0.7.1 */ package com.google.gson; import java.lang.reflect.Type; class DefaultTypeAdapters$IntegerTypeAdapter implements JsonSerializer<Integer>, JsonDeserializer<Integer> { public JsonElement serialize(Integer src, Type typeOfSrc, JsonSerializationContext context) { return new JsonPrimitive(src); } public Integer deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) throws JsonParseException { return Integer.valueOf(json.getAsInt()); } public String toString() { return IntegerTypeAdapter.class.getSimpleName(); } } /* Location: * Qualified Name: com.google.gson.DefaultTypeAdapters.IntegerTypeAdapter * Java Class Version: 5 (49.0) * JD-Core Version: 0.7.1 */ package com.google.gson; import java.lang.reflect.Type; import java.util.Locale; import java.util.StringTokenizer; class DefaultTypeAdapters$LocaleTypeAdapter implements JsonSerializer<Locale>, JsonDeserializer<Locale> { public JsonElement serialize(Locale src, Type typeOfSrc, JsonSerializationContext context) { return new JsonPrimitive(src.toString()); } public Locale deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) throws JsonParseException { String locale = json.getAsString(); StringTokenizer tokenizer = new StringTokenizer(locale, "_"); String language = null; String country = null; String variant = null; if (tokenizer.hasMoreElements()) { language = tokenizer.nextToken(); } if (tokenizer.hasMoreElements()) { country = tokenizer.nextToken(); } if (tokenizer.hasMoreElements()) { variant = tokenizer.nextToken(); } if ((country == null) && (variant == null)) { return new Locale(language); } if (variant == null) { return new Locale(language, country); } return new Locale(language, country, variant); } public String toString() { return LocaleTypeAdapter.class.getSimpleName(); } } /* Location: * Qualified Name: com.google.gson.DefaultTypeAdapters.LocaleTypeAdapter * Java Class Version: 5 (49.0) * JD-Core Version: 0.7.1 */ package com.google.gson; import java.lang.reflect.Type; class DefaultTypeAdapters$LongDeserializer implements JsonDeserializer<Long> { public Long deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) throws JsonParseException { return Long.valueOf(json.getAsLong()); } public String toString() { return LongDeserializer.class.getSimpleName(); } } /* Location: * Qualified Name: com.google.gson.DefaultTypeAdapters.LongDeserializer * Java Class Version: 5 (49.0) * JD-Core Version: 0.7.1 */ package com.google.gson; import java.lang.reflect.Type; class DefaultTypeAdapters$LongSerializer implements JsonSerializer<Long> { private final LongSerializationPolicy longSerializationPolicy; private DefaultTypeAdapters$LongSerializer(LongSerializationPolicy longSerializationPolicy) { this.longSerializationPolicy = longSerializationPolicy; } public JsonElement serialize(Long src, Type typeOfSrc, JsonSerializationContext context) { return longSerializationPolicy.serialize(src); } public String toString() { return LongSerializer.class.getSimpleName(); } } /* Location: * Qualified Name: com.google.gson.DefaultTypeAdapters.LongSerializer * Java Class Version: 5 (49.0) * JD-Core Version: 0.7.1 */ package com.google.gson; import java.lang.reflect.ParameterizedType; import java.lang.reflect.Type; import java.util.LinkedHashMap; import java.util.Map; import java.util.Map.Entry; class DefaultTypeAdapters$MapTypeAdapter implements JsonSerializer<Map>, JsonDeserializer<Map>, InstanceCreator<Map> { public JsonElement serialize(Map src, Type typeOfSrc, JsonSerializationContext context) { JsonObject map = new JsonObject(); Type childGenericType = null; if ((typeOfSrc instanceof ParameterizedType)) { childGenericType = new TypeInfoMap(typeOfSrc).getValueType(); } for (Map.Entry entry : src.entrySet()) { Object value = entry.getValue(); JsonElement valueElement; JsonElement valueElement; if (value == null) { valueElement = JsonNull.createJsonNull(); } else { Type childType = childGenericType == null ? value.getClass() : childGenericType; valueElement = context.serialize(value, childType); } map.add(String.valueOf(entry.getKey()), valueElement); } return map; } public Map deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) throws JsonParseException { Map<Object, Object> map = constructMapType(typeOfT, context); TypeInfoMap mapTypeInfo = new TypeInfoMap(typeOfT); for (Map.Entry<String, JsonElement> entry : json.getAsJsonObject().entrySet()) { Object key = context.deserialize(new JsonPrimitive((String)entry.getKey()), mapTypeInfo.getKeyType()); Object value = context.deserialize((JsonElement)entry.getValue(), mapTypeInfo.getValueType()); map.put(key, value); } return map; } private Map constructMapType(Type mapType, JsonDeserializationContext context) { JsonDeserializationContextDefault contextImpl = (JsonDeserializationContextDefault)context; ObjectConstructor objectConstructor = contextImpl.getObjectConstructor(); return (Map)objectConstructor.construct(mapType); } public Map createInstance(Type type) { return new LinkedHashMap(); } public String toString() { return MapTypeAdapter.class.getSimpleName(); } } /* Location: * Qualified Name: com.google.gson.DefaultTypeAdapters.MapTypeAdapter * Java Class Version: 5 (49.0) * JD-Core Version: 0.7.1 */ package com.google.gson; import java.lang.reflect.Type; class DefaultTypeAdapters$NumberTypeAdapter implements JsonSerializer<Number>, JsonDeserializer<Number> { public JsonElement serialize(Number src, Type typeOfSrc, JsonSerializationContext context) { return new JsonPrimitive(src); } public Number deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) throws JsonParseException { return json.getAsNumber(); } public String toString() { return NumberTypeAdapter.class.getSimpleName(); } } /* Location: * Qualified Name: com.google.gson.DefaultTypeAdapters.NumberTypeAdapter * Java Class Version: 5 (49.0) * JD-Core Version: 0.7.1 */ package com.google.gson; import java.lang.reflect.Type; import java.util.Properties; class DefaultTypeAdapters$PropertiesCreator implements InstanceCreator<Properties> { public Properties createInstance(Type type) { return new Properties(); } } /* Location: * Qualified Name: com.google.gson.DefaultTypeAdapters.PropertiesCreator * Java Class Version: 5 (49.0) * JD-Core Version: 0.7.1 */ package com.google.gson; import java.lang.reflect.Type; class DefaultTypeAdapters$ShortTypeAdapter implements JsonSerializer<Short>, JsonDeserializer<Short> { public JsonElement serialize(Short src, Type typeOfSrc, JsonSerializationContext context) { return new JsonPrimitive(src); } public Short deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) throws JsonParseException { return Short.valueOf(json.getAsShort()); } public String toString() { return ShortTypeAdapter.class.getSimpleName(); } } /* Location: * Qualified Name: com.google.gson.DefaultTypeAdapters.ShortTypeAdapter * Java Class Version: 5 (49.0) * JD-Core Version: 0.7.1 */ package com.google.gson; import java.lang.reflect.Type; class DefaultTypeAdapters$StringTypeAdapter implements JsonSerializer<String>, JsonDeserializer<String> { public JsonElement serialize(String src, Type typeOfSrc, JsonSerializationContext context) { return new JsonPrimitive(src); } public String deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) throws JsonParseException { return json.getAsString(); } public String toString() { return StringTypeAdapter.class.getSimpleName(); } } /* Location: * Qualified Name: com.google.gson.DefaultTypeAdapters.StringTypeAdapter * Java Class Version: 5 (49.0) * JD-Core Version: 0.7.1 */ package com.google.gson; import java.lang.reflect.Type; import java.util.TreeSet; class DefaultTypeAdapters$TreeSetCreator implements InstanceCreator<TreeSet<?>> { public TreeSet<?> createInstance(Type type) { return new TreeSet(); } public String toString() { return TreeSetCreator.class.getSimpleName(); } } /* Location: * Qualified Name: com.google.gson.DefaultTypeAdapters.TreeSetCreator * Java Class Version: 5 (49.0) * JD-Core Version: 0.7.1 */ package com.google.gson; import java.lang.reflect.Type; import java.net.URI; import java.net.URISyntaxException; class DefaultTypeAdapters$UriTypeAdapter implements JsonSerializer<URI>, JsonDeserializer<URI> { public JsonElement serialize(URI src, Type typeOfSrc, JsonSerializationContext context) { return new JsonPrimitive(src.toASCIIString()); } public URI deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) throws JsonParseException { try { return new URI(json.getAsString()); } catch (URISyntaxException e) { throw new JsonSyntaxException(e); } } public String toString() { return UriTypeAdapter.class.getSimpleName(); } } /* Location: * Qualified Name: com.google.gson.DefaultTypeAdapters.UriTypeAdapter * Java Class Version: 5 (49.0) * JD-Core Version: 0.7.1 */ package com.google.gson; import java.lang.reflect.Type; import java.net.MalformedURLException; import java.net.URL; class DefaultTypeAdapters$UrlTypeAdapter implements JsonSerializer<URL>, JsonDeserializer<URL> { public JsonElement serialize(URL src, Type typeOfSrc, JsonSerializationContext context) { return new JsonPrimitive(src.toExternalForm()); } public URL deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) throws JsonParseException { try { return new URL(json.getAsString()); } catch (MalformedURLException e) { throw new JsonSyntaxException(e); } } public String toString() { return UrlTypeAdapter.class.getSimpleName(); } } /* Location: * Qualified Name: com.google.gson.DefaultTypeAdapters.UrlTypeAdapter * Java Class Version: 5 (49.0) * JD-Core Version: 0.7.1 */ package com.google.gson; import java.lang.reflect.Type; import java.util.UUID; class DefaultTypeAdapters$UuidTypeAdapter implements JsonSerializer<UUID>, JsonDeserializer<UUID> { public JsonElement serialize(UUID src, Type typeOfSrc, JsonSerializationContext context) { return new JsonPrimitive(src.toString()); } public UUID deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) throws JsonParseException { return UUID.fromString(json.getAsString()); } public String toString() { return UuidTypeAdapter.class.getSimpleName(); } } /* Location: * Qualified Name: com.google.gson.DefaultTypeAdapters.UuidTypeAdapter * Java Class Version: 5 (49.0) * JD-Core Version: 0.7.1 */ package com.google.gson; import java.lang.reflect.ParameterizedType; import java.lang.reflect.Type; import java.math.BigDecimal; import java.math.BigInteger; import java.net.MalformedURLException; import java.net.URI; import java.net.URISyntaxException; import java.net.URL; import java.sql.Time; import java.sql.Timestamp; import java.text.DateFormat; import java.text.SimpleDateFormat; import java.util.Calendar; import java.util.Collection; import java.util.GregorianCalendar; import java.util.HashSet; Further reading...For more information on Java 1.5 Tiger, you may find Java 1.5 Tiger, A developer's Notebook by D. Flanagan and B. McLaughlin from O'Reilly of interest.New!JAR listings
|