pax_global_header 0000666 0000000 0000000 00000000064 12604067504 0014516 g ustar 00root root 0000000 0000000 52 comment=5d414d68ea79cc01bdd574656099a08228b82aa2
gson-gson-2.4/ 0000775 0000000 0000000 00000000000 12604067504 0013275 5 ustar 00root root 0000000 0000000 gson-gson-2.4/.gitignore 0000664 0000000 0000000 00000000174 12604067504 0015267 0 ustar 00root root 0000000 0000000 .classpath
.project
.settings
eclipsebin
*/target
pom.xml.*
release.properties
.idea
*.iml
*.ipr
*.iws
classes
.DS_Store
gson-gson-2.4/.travis.yml 0000664 0000000 0000000 00000000362 12604067504 0015407 0 ustar 00root root 0000000 0000000 language: java
jdk:
- oraclejdk7
- oraclejdk8
install: mvn -f gson install -DskipTests=true
script: mvn -f gson test
branches:
except:
- gh-pages
notifications:
email: false
sudo: false
cache:
directories:
- $HOME/.m2
gson-gson-2.4/CHANGELOG.md 0000664 0000000 0000000 00000001504 12604067504 0015106 0 ustar 00root root 0000000 0000000 Change Log
==========
## Version 2.4.0
_RELEASE DATE TBA_
* **Drop `IOException` from `TypeAdapter.toJson()`.** This is a binary-compatible change, but may
cause compiler errors where `IOExceptions` are being caught but no longer thrown. The correct fix
for this problem is to remove the unnecessary `catch` clause.
* New: `Gson.newJsonWriter` method returns configured `JsonWriter` instances.
* New: `@SerializedName` now works with [AutoValue’s][autovalue] abstract property methods.
* New: `JsonWriter#jsonValue` writes raw JSON values.
* New: APIs to add primitives directly to `JsonArray` instances.
* New: ISO 8601 type adapter. Find this in _extras_.
* Fix: `FieldNamingPolicy` now works properly when running on a device with a Turkish locale.
[autovalue]: https://github.com/google/auto/tree/master/value
gson-gson-2.4/LICENSE 0000664 0000000 0000000 00000001051 12604067504 0014277 0 ustar 00root root 0000000 0000000 Copyright 2008 Google Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
gson-gson-2.4/README.md 0000664 0000000 0000000 00000004072 12604067504 0014557 0 ustar 00root root 0000000 0000000 # google-gson
Gson is a Java library that can be used to convert Java Objects into their JSON representation. It can also be used to convert a JSON string to an equivalent Java object.
Gson can work with arbitrary Java objects including pre-existing objects that you do not have source-code of.
There are a few open-source projects that can convert Java objects to JSON. However, most of them require that you place Java annotations in your classes; something that you can not do if you do not have access to the source-code. Most also do not fully support the use of Java Generics. Gson considers both of these as very important design goals.
*Gson Goals*
* Provide simple toJson() and fromJson() methods to convert Java objects to JSON and vice-versa
* Allow pre-existing unmodifiable objects to be converted to and from JSON
* Extensive support of Java Generics
* Allow custom representations for objects
* Support arbitrarily complex objects (with deep inheritance hierarchies and extensive use of generic types)
*Gson Downloads*
* [Gson 2.3.1 Download](http://search.maven.org/#artifactdetails%7Ccom.google.code.gson%7Cgson%7C2.3.1%7Cjar) downloads at Maven Central
*Gson Documentation*
* Gson [API](http://google-gson.googlecode.com/svn/trunk/gson/docs/javadocs/index.html): Javadocs for the current Gson release
* Gson [user guide](http://sites.google.com/site/gson/gson-user-guide): This guide contains examples on how to use Gson in your code.
* Gson [Roadmap](https://sites.google.com/site/gson/gson-roadmap): Details on upcoming releases
* Gson [design document](https://sites.google.com/site/gson/gson-design-document): This document discusses issues we faced while designing Gson. It also include a comparison of Gson with other Java libraries that can be used for Json conversion
Please use the [google-gson Google group](http://groups.google.com/group/google-gson) to discuss Gson, or to post questions.
*Gson-related Content Created by Third Parties*
* [Gson Tutorial](http://www.studytrails.com/java/json/java-google-json-introduction.jsp) by `StudyTrails`
gson-gson-2.4/codegen/ 0000775 0000000 0000000 00000000000 12604067504 0014701 5 ustar 00root root 0000000 0000000 gson-gson-2.4/codegen/pom.xml 0000664 0000000 0000000 00000013304 12604067504 0016217 0 ustar 00root root 0000000 0000000 4.0.0com.google.code.gsongson-codegenjar1.0-SNAPSHOT2008Gson Code Genorg.sonatype.ossoss-parent7http://code.google.com/p/google-gson/Google Gson grab bag of utilities, type adapters, etc.UTF-8The Apache Software License, Version 2.0http://www.apache.org/licenses/LICENSE-2.0.txtreposcm:svn:http://google-gson.googlecode.com/svn/trunk/extrasscm:svn:https://google-gson.googlecode.com/svn/trunk/extrashttp://google-gson.codegoogle.com/svn/trunk/extrasGoogle Code Issue Trackinghttp://code.google.com/p/google-gson/issues/listGoogle, Inc.http://www.google.comjunitjunit3.8.2testrelease-sign-artifactsperformReleasetrueorg.apache.maven.pluginsmaven-gpg-plugin1.4sign-artifactsverifysignpackageorg.apache.maven.pluginsmaven-compiler-plugin2.5.11.61.6-proc:noneorg.apache.maven.pluginsmaven-jar-plugin2.4packagejarfalseorg.apache.maven.pluginsmaven-source-plugin2.1.2attach-sourcesverifyjarorg.apache.maven.pluginsmaven-javadoc-plugin2.8.1attach-javadocsjar
http://download.oracle.com/javase/1.5.0/docs/api/
truepublicorg.apache.maven.pluginsmaven-eclipse-plugin2.9truetrue
../eclipse-ws/
file:///${basedir}/../lib/gson-formatting-styles.xml
org.apache.maven.pluginsmaven-release-plugin-DenableCiProfile=truehttps://google-gson.googlecode.com/svn/tags/Inderjeet SinghTrymph Inc.Joel LeitchGoogle Inc.Jesse WilsonSquare Inc.
gson-gson-2.4/codegen/src/ 0000775 0000000 0000000 00000000000 12604067504 0015470 5 ustar 00root root 0000000 0000000 gson-gson-2.4/codegen/src/main/ 0000775 0000000 0000000 00000000000 12604067504 0016414 5 ustar 00root root 0000000 0000000 gson-gson-2.4/codegen/src/main/java/ 0000775 0000000 0000000 00000000000 12604067504 0017335 5 ustar 00root root 0000000 0000000 gson-gson-2.4/codegen/src/main/java/com/ 0000775 0000000 0000000 00000000000 12604067504 0020113 5 ustar 00root root 0000000 0000000 gson-gson-2.4/codegen/src/main/java/com/google/ 0000775 0000000 0000000 00000000000 12604067504 0021367 5 ustar 00root root 0000000 0000000 gson-gson-2.4/codegen/src/main/java/com/google/gson/ 0000775 0000000 0000000 00000000000 12604067504 0022335 5 ustar 00root root 0000000 0000000 gson-gson-2.4/codegen/src/main/java/com/google/gson/codegen/ 0000775 0000000 0000000 00000000000 12604067504 0023741 5 ustar 00root root 0000000 0000000 gson-gson-2.4/codegen/src/main/java/com/google/gson/codegen/CodeGen.java 0000664 0000000 0000000 00000003372 12604067504 0026115 0 ustar 00root root 0000000 0000000 /*
* Copyright (C) 2012 Square, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.google.gson.codegen;
import javax.lang.model.element.Element;
import javax.lang.model.element.ElementKind;
import javax.lang.model.element.PackageElement;
import javax.lang.model.element.TypeElement;
public class CodeGen {
private CodeGen() {
}
public static PackageElement getPackage(Element type) {
while (type.getKind() != ElementKind.PACKAGE) {
type = type.getEnclosingElement();
}
return (PackageElement) type;
}
/**
* Returns a fully qualified class name to complement {@code type}.
*/
public static String adapterName(TypeElement typeElement, String suffix) {
StringBuilder builder = new StringBuilder();
rawTypeToString(builder, typeElement, '$');
builder.append(suffix);
return builder.toString();
}
static void rawTypeToString(StringBuilder result, TypeElement type, char innerClassSeparator) {
String packageName = getPackage(type).getQualifiedName().toString();
String qualifiedName = type.getQualifiedName().toString();
result.append(packageName);
result.append('.');
result.append(
qualifiedName.substring(packageName.length() + 1).replace('.', innerClassSeparator));
}
}
gson-gson-2.4/codegen/src/main/java/com/google/gson/codegen/GeneratedTypeAdapter.java 0000664 0000000 0000000 00000001307 12604067504 0030646 0 ustar 00root root 0000000 0000000 /*
* Copyright (C) 2012 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.google.gson.codegen;
public @interface GeneratedTypeAdapter {
Class>[] value() default {};
}
gson-gson-2.4/codegen/src/main/java/com/google/gson/codegen/GeneratedTypeAdapterProcessor.java 0000664 0000000 0000000 00000004554 12604067504 0032555 0 ustar 00root root 0000000 0000000 /*
* Copyright (C) 2012 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.google.gson.codegen;
import static java.lang.reflect.Modifier.FINAL;
import java.io.IOException;
import java.util.Set;
import javax.annotation.processing.AbstractProcessor;
import javax.annotation.processing.RoundEnvironment;
import javax.annotation.processing.SupportedAnnotationTypes;
import javax.annotation.processing.SupportedSourceVersion;
import javax.lang.model.SourceVersion;
import javax.lang.model.element.Element;
import javax.lang.model.element.TypeElement;
import javax.tools.Diagnostic;
import javax.tools.JavaFileObject;
@SupportedAnnotationTypes("com.google.gson.codegen.GeneratedTypeAdapter")
@SupportedSourceVersion(SourceVersion.RELEASE_6)
public final class GeneratedTypeAdapterProcessor extends AbstractProcessor {
@Override public boolean process(Set extends TypeElement> types, RoundEnvironment env) {
System.out.println("invoked GeneratedTypeAdapterProcessor");
try {
for (Element element : env.getElementsAnnotatedWith(GeneratedTypeAdapter.class)) {
writeAdapter((TypeElement) element);
}
} catch (IOException e) {
processingEnv.getMessager().printMessage(Diagnostic.Kind.ERROR, e.getMessage());
}
return true;
}
private void writeAdapter(TypeElement type) throws IOException {
String typeAdapterName = CodeGen.adapterName(type, "$TypeAdapter");
JavaFileObject sourceFile = processingEnv.getFiler()
.createSourceFile(typeAdapterName, type);
System.out.println("Generating type adapter: " + typeAdapterName + " in " + sourceFile.getName());
JavaWriter writer = new JavaWriter(sourceFile.openWriter());
writer.addPackage(CodeGen.getPackage(type).getQualifiedName().toString());
writer.beginType(typeAdapterName, "class", FINAL, null);
writer.endType();
writer.close();
}
}
gson-gson-2.4/codegen/src/main/java/com/google/gson/codegen/JavaWriter.java 0000664 0000000 0000000 00000026576 12604067504 0026702 0 ustar 00root root 0000000 0000000 /**
* Copyright (C) 2012 Square, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.google.gson.codegen;
import java.io.IOException;
import java.io.Writer;
import java.lang.annotation.Annotation;
import java.lang.reflect.Modifier;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
/**
* Emits Java source files.
*/
public final class JavaWriter {
private static final Pattern TYPE_PATTERN = Pattern.compile("(?:[\\w$]+\\.)*([\\w$]+)");
private static final String INDENT = " ";
/** Map fully qualified type names to their short names. */
private final Map importedTypes = new HashMap();
private String packagePrefix;
private final List scopes = new ArrayList();
private final Writer out;
/**
* @param out the stream to which Java source will be written. This should be
* a buffered stream.
*/
public JavaWriter(Writer out) {
this.out = out;
}
/**
* Emit a package declaration.
*/
public void addPackage(String packageName) throws IOException {
if (this.packagePrefix != null) {
throw new IllegalStateException();
}
out.write("package ");
out.write(packageName);
out.write(";\n");
this.packagePrefix = packageName + ".";
}
/**
* Equivalent to {@code addImport(type.getName())}.
*/
public void addImport(Class> type) throws IOException {
addImport(type.getName());
}
/**
* Emit an import for {@code type}. For the duration of the file, all
* references to this class will be automatically shortened.
*/
public void addImport(String type) throws IOException {
Matcher matcher = TYPE_PATTERN.matcher(type);
if (!matcher.matches()) {
throw new IllegalArgumentException(type);
}
if (importedTypes.put(type, matcher.group(1)) != null) {
throw new IllegalArgumentException(type);
}
out.write("import ");
out.write(type);
out.write(";\n");
}
/**
* Emits a name like {@code java.lang.String} or {@code
* java.util.List}, shorting it with imports if
* possible.
*/
private void type(String type) throws IOException {
if (this.packagePrefix == null) {
throw new IllegalStateException();
}
Matcher m = TYPE_PATTERN.matcher(type);
int pos = 0;
while (true) {
boolean found = m.find(pos);
// copy non-matching characters like "<"
int typeStart = found ? m.start() : type.length();
out.write(type, pos, typeStart - pos);
if (!found) {
break;
}
// copy a single class name, shortening it if possible
String name = m.group(0);
String imported;
if ((imported = importedTypes.get(name)) != null) {
out.write(imported);
} else if (name.startsWith(packagePrefix)
&& name.indexOf('.', packagePrefix.length()) == -1) {
out.write(name.substring(packagePrefix.length()));
} else if (name.startsWith("java.lang.")) {
out.write(name.substring("java.lang.".length()));
} else {
out.write(name);
}
pos = m.end();
}
}
/**
* Emits a type declaration.
*
* @param kind such as "class", "interface" or "enum".
*/
public void beginType(String type, String kind, int modifiers) throws IOException {
beginType(type, kind, modifiers, null);
}
/**
* Emits a type declaration.
*
* @param kind such as "class", "interface" or "enum".
* @param extendsType the class to extend, or null for no extends clause.
*/
public void beginType(String type, String kind, int modifiers,
String extendsType, String... implementsTypes) throws IOException {
indent();
modifiers(modifiers);
out.write(kind);
out.write(" ");
type(type);
if (extendsType != null) {
out.write("\n");
indent();
out.write(" extends ");
type(extendsType);
}
if (implementsTypes.length > 0) {
out.write("\n");
indent();
out.write(" implements ");
for (int i = 0; i < implementsTypes.length; i++) {
if (i != 0) {
out.write(", ");
}
type(implementsTypes[i]);
}
}
out.write(" {\n");
pushScope(Scope.TYPE_DECLARATION);
}
/**
* Completes the current type declaration.
*/
public void endType() throws IOException {
if (popScope() != Scope.TYPE_DECLARATION) {
throw new IllegalStateException();
}
indent();
out.write("}\n");
}
/**
* Emits a field declaration.
*/
public void field(String type, String name, int modifiers) throws IOException {
field(type, name, modifiers, null);
}
public void field(String type, String name, int modifiers, String initialValue)
throws IOException {
indent();
modifiers(modifiers);
type(type);
out.write(" ");
out.write(name);
if (initialValue != null) {
out.write(" = ");
out.write(initialValue);
}
out.write(";\n");
}
/**
* Emit a method declaration.
*
* @param returnType the method's return type, or null for constructors.
* @param parameters alternating parameter types and names.
* @param name the method name, or the fully qualified class name for
* constructors.
*/
public void beginMethod(String returnType, String name, int modifiers, String... parameters)
throws IOException {
indent();
modifiers(modifiers);
if (returnType != null) {
type(returnType);
out.write(" ");
out.write(name);
} else {
type(name);
}
out.write("(");
for (int p = 0; p < parameters.length; ) {
if (p != 0) {
out.write(", ");
}
type(parameters[p++]);
out.write(" ");
type(parameters[p++]);
}
out.write(")");
if ((modifiers & Modifier.ABSTRACT) != 0) {
out.write(";\n");
pushScope(Scope.ABSTRACT_METHOD);
} else {
out.write(" {\n");
pushScope(Scope.NON_ABSTRACT_METHOD);
}
}
/**
* Annotates the next element with {@code annotation}. The annotation has no
* attributes.
*/
public void annotation(String annotation) throws IOException {
indent();
out.write("@");
type(annotation);
out.write("\n");
}
/**
* Equivalent to {@code annotation(annotationType.getName())}.
*/
public void annotation(Class extends Annotation> annotationType) throws IOException {
annotation(annotationType.getName());
}
/**
* @param pattern a code pattern like "int i = %s". Shouldn't contain a
* trailing semicolon or newline character.
*/
public void statement(String pattern, Object... args) throws IOException {
checkInMethod();
indent();
out.write(String.format(pattern, args));
out.write(";\n");
}
/**
* @param controlFlow the control flow construct and its code, such as
* "if (foo == 5)". Shouldn't contain braces or newline characters.
*/
public void beginControlFlow(String controlFlow) throws IOException {
checkInMethod();
indent();
out.write(controlFlow);
out.write(" {\n");
pushScope(Scope.CONTROL_FLOW);
}
/**
* @param controlFlow the control flow construct and its code, such as
* "else if (foo == 10)". Shouldn't contain braces or newline characters.
*/
public void nextControlFlow(String controlFlow) throws IOException {
if (popScope() != Scope.CONTROL_FLOW) {
throw new IllegalArgumentException();
}
indent();
pushScope(Scope.CONTROL_FLOW);
out.write("} ");
out.write(controlFlow);
out.write(" {\n");
}
public void endControlFlow() throws IOException {
endControlFlow(null);
}
/**
* @param controlFlow the optional control flow construct and its code, such
* as "while(foo == 20)". Only used for "do/while" control flows.
*/
public void endControlFlow(String controlFlow) throws IOException {
if (popScope() != Scope.CONTROL_FLOW) {
throw new IllegalArgumentException();
}
indent();
if (controlFlow != null) {
out.write("} ");
out.write(controlFlow);
out.write(";\n");
} else {
out.write("}\n");
}
}
/**
* Completes the current method declaration.
*/
public void endMethod() throws IOException {
Scope popped = popScope();
if (popped == Scope.NON_ABSTRACT_METHOD) {
indent();
out.write("}\n");
} else if (popped != Scope.ABSTRACT_METHOD) {
throw new IllegalStateException();
}
}
/**
* Returns the string literal representing {@code data}, including wrapping
* quotes.
*/
public static String stringLiteral(String data) {
StringBuilder result = new StringBuilder();
result.append('"');
for (int i = 0; i < data.length(); i++) {
char c = data.charAt(i);
switch (c) {
case '"':
result.append("\\\"");
break;
case '\\':
result.append("\\\\");
break;
case '\t':
result.append("\\\t");
break;
case '\b':
result.append("\\\b");
break;
case '\n':
result.append("\\\n");
break;
case '\r':
result.append("\\\r");
break;
case '\f':
result.append("\\\f");
break;
default:
result.append(c);
}
}
result.append('"');
return result.toString();
}
public void close() throws IOException {
out.close();
}
/**
* Emit modifier names.
*/
private void modifiers(int modifiers) throws IOException {
if ((modifiers & Modifier.PUBLIC) != 0) {
out.write("public ");
}
if ((modifiers & Modifier.PRIVATE) != 0) {
out.write("private ");
}
if ((modifiers & Modifier.PROTECTED) != 0) {
out.write("protected ");
}
if ((modifiers & Modifier.STATIC) != 0) {
out.write("static ");
}
if ((modifiers & Modifier.FINAL) != 0) {
out.write("final ");
}
if ((modifiers & Modifier.ABSTRACT) != 0) {
out.write("abstract ");
}
if ((modifiers & Modifier.SYNCHRONIZED) != 0) {
out.write("synchronized ");
}
if ((modifiers & Modifier.TRANSIENT) != 0) {
out.write("transient ");
}
if ((modifiers & Modifier.VOLATILE) != 0) {
out.write("volatile ");
}
}
private void indent() throws IOException {
for (int i = 0; i < scopes.size(); i++) {
out.write(INDENT);
}
}
private void checkInMethod() {
Scope scope = peekScope();
if (scope != Scope.NON_ABSTRACT_METHOD && scope != Scope.CONTROL_FLOW) {
throw new IllegalArgumentException();
}
}
private void pushScope(Scope pushed) {
scopes.add(pushed);
}
private Scope peekScope() {
return scopes.get(scopes.size() - 1);
}
private Scope popScope() {
return scopes.remove(scopes.size() - 1);
}
private enum Scope {
TYPE_DECLARATION,
ABSTRACT_METHOD,
NON_ABSTRACT_METHOD,
CONTROL_FLOW,
}
}
gson-gson-2.4/codegen/src/main/resources/ 0000775 0000000 0000000 00000000000 12604067504 0020426 5 ustar 00root root 0000000 0000000 gson-gson-2.4/codegen/src/main/resources/META-INF/ 0000775 0000000 0000000 00000000000 12604067504 0021566 5 ustar 00root root 0000000 0000000 gson-gson-2.4/codegen/src/main/resources/META-INF/services/ 0000775 0000000 0000000 00000000000 12604067504 0023411 5 ustar 00root root 0000000 0000000 gson-gson-2.4/codegen/src/main/resources/META-INF/services/javax.annotation.processing.Processor 0000664 0000000 0000000 00000000065 12604067504 0032750 0 ustar 00root root 0000000 0000000 com.google.gson.codegen.GeneratedTypeAdapterProcessor gson-gson-2.4/codegen/src/test/ 0000775 0000000 0000000 00000000000 12604067504 0016447 5 ustar 00root root 0000000 0000000 gson-gson-2.4/codegen/src/test/java/ 0000775 0000000 0000000 00000000000 12604067504 0017370 5 ustar 00root root 0000000 0000000 gson-gson-2.4/codegen/src/test/java/com/ 0000775 0000000 0000000 00000000000 12604067504 0020146 5 ustar 00root root 0000000 0000000 gson-gson-2.4/codegen/src/test/java/com/google/ 0000775 0000000 0000000 00000000000 12604067504 0021422 5 ustar 00root root 0000000 0000000 gson-gson-2.4/codegen/src/test/java/com/google/gson/ 0000775 0000000 0000000 00000000000 12604067504 0022370 5 ustar 00root root 0000000 0000000 gson-gson-2.4/codegen/src/test/java/com/google/gson/codegen/ 0000775 0000000 0000000 00000000000 12604067504 0023774 5 ustar 00root root 0000000 0000000 gson-gson-2.4/codegen/src/test/java/com/google/gson/codegen/functional/ 0000775 0000000 0000000 00000000000 12604067504 0026136 5 ustar 00root root 0000000 0000000 gson-gson-2.4/codegen/src/test/java/com/google/gson/codegen/functional/CodeGenFunctionalTest.java 0000664 0000000 0000000 00000001561 12604067504 0033173 0 ustar 00root root 0000000 0000000 /*
* Copyright (C) 2012 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.google.gson.codegen.functional;
import junit.framework.TestCase;
public class CodeGenFunctionalTest extends TestCase {
public void testGeneratedJson() {
Order order = new Order("toy", 10);
// TODO: figure out how to access the generated type adapter
}
}
gson-gson-2.4/codegen/src/test/java/com/google/gson/codegen/functional/Order.java 0000664 0000000 0000000 00000001767 12604067504 0030067 0 ustar 00root root 0000000 0000000 /*
* Copyright (C) 2012 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.google.gson.codegen.functional;
import com.google.gson.codegen.GeneratedTypeAdapter;
@GeneratedTypeAdapter
final class Order {
private final String itemName;
private final int price;
public Order(String itemName, int price) {
this.itemName = itemName;
this.price = price;
}
public String getItemName() {
return itemName;
}
public int getAmount() {
return price;
}
}
gson-gson-2.4/examples/ 0000775 0000000 0000000 00000000000 12604067504 0015113 5 ustar 00root root 0000000 0000000 gson-gson-2.4/examples/android-proguard-example/ 0000775 0000000 0000000 00000000000 12604067504 0022005 5 ustar 00root root 0000000 0000000 gson-gson-2.4/examples/android-proguard-example/AndroidManifest.xml 0000775 0000000 0000000 00000001613 12604067504 0025602 0 ustar 00root root 0000000 0000000
gson-gson-2.4/examples/android-proguard-example/default.properties 0000664 0000000 0000000 00000000606 12604067504 0025551 0 ustar 00root root 0000000 0000000 # This file is automatically generated by Android Tools.
# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
#
# This file must be checked in Version Control Systems.
#
# To customize properties used by the Ant build system use,
# "build.properties", and override values to adapt the script to your
# project structure.
# Project target.
target=android-3
proguard.config=proguard.cfg gson-gson-2.4/examples/android-proguard-example/proguard.cfg 0000664 0000000 0000000 00000006146 12604067504 0024320 0 ustar 00root root 0000000 0000000 ##---------------Begin: proguard configuration common for all Android apps ----------
-optimizationpasses 5
-dontusemixedcaseclassnames
-dontskipnonpubliclibraryclasses
-dontskipnonpubliclibraryclassmembers
-dontpreverify
-verbose
-dump class_files.txt
-printseeds seeds.txt
-printusage unused.txt
-printmapping mapping.txt
-optimizations !code/simplification/arithmetic,!field/*,!class/merging/*
-allowaccessmodification
-keepattributes *Annotation*
-renamesourcefileattribute SourceFile
-keepattributes SourceFile,LineNumberTable
-repackageclasses ''
-keep public class * extends android.app.Activity
-keep public class * extends android.app.Application
-keep public class * extends android.app.Service
-keep public class * extends android.content.BroadcastReceiver
-keep public class * extends android.content.ContentProvider
-keep public class * extends android.app.backup.BackupAgentHelper
-keep public class * extends android.preference.Preference
-keep public class com.android.vending.licensing.ILicensingService
-dontnote com.android.vending.licensing.ILicensingService
# Explicitly preserve all serialization members. The Serializable interface
# is only a marker interface, so it wouldn't save them.
-keepclassmembers class * implements java.io.Serializable {
static final long serialVersionUID;
private static final java.io.ObjectStreamField[] serialPersistentFields;
private void writeObject(java.io.ObjectOutputStream);
private void readObject(java.io.ObjectInputStream);
java.lang.Object writeReplace();
java.lang.Object readResolve();
}
# Preserve all native method names and the names of their classes.
-keepclasseswithmembernames class * {
native ;
}
-keepclasseswithmembernames class * {
public (android.content.Context, android.util.AttributeSet);
}
-keepclasseswithmembernames class * {
public (android.content.Context, android.util.AttributeSet, int);
}
# Preserve static fields of inner classes of R classes that might be accessed
# through introspection.
-keepclassmembers class **.R$* {
public static ;
}
# Preserve the special static methods that are required in all enumeration classes.
-keepclassmembers enum * {
public static **[] values();
public static ** valueOf(java.lang.String);
}
-keep public class * {
public protected *;
}
-keep class * implements android.os.Parcelable {
public static final android.os.Parcelable$Creator *;
}
##---------------End: proguard configuration common for all Android apps ----------
##---------------Begin: proguard configuration for Gson ----------
# Gson uses generic type information stored in a class file when working with fields. Proguard
# removes such information by default, so configure it to keep all of it.
-keepattributes Signature
# For using GSON @Expose annotation
-keepattributes *Annotation*
# Gson specific classes
-keep class sun.misc.Unsafe { *; }
#-keep class com.google.gson.stream.** { *; }
# Application classes that will be serialized/deserialized over Gson
-keep class com.google.gson.examples.android.model.** { *; }
##---------------End: proguard configuration for Gson ----------
gson-gson-2.4/examples/android-proguard-example/res/ 0000775 0000000 0000000 00000000000 12604067504 0022576 5 ustar 00root root 0000000 0000000 gson-gson-2.4/examples/android-proguard-example/res/drawable/ 0000775 0000000 0000000 00000000000 12604067504 0024357 5 ustar 00root root 0000000 0000000 gson-gson-2.4/examples/android-proguard-example/res/drawable/icon.png 0000664 0000000 0000000 00000005016 12604067504 0026017 0 ustar 00root root 0000000 0000000 PNG
IHDR 0 0 W IDAThY[W{fwe].ׅ@ %b2&!B-IJԊԔK2/
jIIʒ1%/ "
.˲6Kw=NO@_>p{5T|*$W4RIJrA¸NL0u@X>d`vq}a'uhɃ{H(JLE(P5g~>Sר~;c}_ЋG&Ƈx\RU)Z)[|Y
fE]~A $XE,M,$YjF%@f"d\R )3 s'E{Ab<S +9PY^gpEPQyfL{"G_cjt&uη}YkdN=SVl