io.keen.client.android
Class AndroidJsonHandler

java.lang.Object
  extended by io.keen.client.android.AndroidJsonHandler
All Implemented Interfaces:
io.keen.client.java.KeenJsonHandler

public class AndroidJsonHandler
extends Object
implements io.keen.client.java.KeenJsonHandler

Implementation of the KeenJsonHandler interface using the built-in Android JSON library (JSONObject).

Since:
2.0.0

Constructor Summary
AndroidJsonHandler()
           
 
Method Summary
 Map<String,Object> readJson(Reader reader)
          
 void setWrapNestedMapsAndCollections(boolean value)
          Sets whether or not this handler should wrap nested maps and collections explicitly.
 void writeJson(Writer writer, Map<String,?> value)
          
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AndroidJsonHandler

public AndroidJsonHandler()
Method Detail

readJson

public Map<String,Object> readJson(Reader reader)
                            throws IOException

Specified by:
readJson in interface io.keen.client.java.KeenJsonHandler
Throws:
IOException

writeJson

public void writeJson(Writer writer,
                      Map<String,?> value)
               throws IOException

Specified by:
writeJson in interface io.keen.client.java.KeenJsonHandler
Throws:
IOException

setWrapNestedMapsAndCollections

public void setWrapNestedMapsAndCollections(boolean value)
Sets whether or not this handler should wrap nested maps and collections explicitly. If set to false, maps will be passed directly to JSONObject's constructor without any modification. Wrapping is necessary on older versions of Android due to a bug in the org.json implementation. For details, see: https://code.google.com/p/android/issues/detail?id=55114 In general, clients of the SDK should never change the default for this value unless they have done extensive testing and understand the risks.

Parameters:
value - true to enable wrapping, false to disable it.