Skip to content

Commit ab1a65d

Browse files
author
Yaniv Inbar
committed
http: add AndroidJsonFactory.getDefaultInstance()
https://codereview.appspot.com/12896043/
1 parent c623c9f commit ab1a65d

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

google-http-client-android/src/main/java/com/google/api/client/extensions/android/json/AndroidJsonFactory.java

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,20 @@
5454
@Beta
5555
public class AndroidJsonFactory extends JsonFactory {
5656

57+
/**
58+
* Returns a global thread-safe instance.
59+
*
60+
* @since 1.17
61+
*/
62+
public static AndroidJsonFactory getDefaultInstance() {
63+
return InstanceHolder.INSTANCE;
64+
}
65+
66+
/** Holder for the result of {@link #getDefaultInstance()}. */
67+
static class InstanceHolder {
68+
static final AndroidJsonFactory INSTANCE = new AndroidJsonFactory();
69+
}
70+
5771
// TODO(yanivi): figure out how to run unit tests based on Android platform
5872

5973
public AndroidJsonFactory() {

0 commit comments

Comments
 (0)