com.fasterxml.jackson.jr.ob.impl
Class JSONAsObjectCodec

java.lang.Object
  extended by com.fasterxml.jackson.core.TreeCodec
      extended by com.fasterxml.jackson.core.ObjectCodec
          extended by com.fasterxml.jackson.jr.ob.impl.JSONAsObjectCodec
All Implemented Interfaces:
Versioned

public class JSONAsObjectCodec
extends ObjectCodec

Convenience wrapper around JSON that implements ObjectCodec. Note that implementation is not complete, due to natural limitations of JSON and "simple" object binding.

The main use case is to give minimal context for other components that expect to get a ObjectCodec, such as JsonParser and JsonGenerator.


Field Summary
protected  JSON _json
           
protected  JsonFactory _jsonFactory
           
protected  TreeCodec _treeCodec
           
 
Constructor Summary
JSONAsObjectCodec(JSON json)
           
JSONAsObjectCodec(JSON json, JsonFactory jf)
           
JSONAsObjectCodec(JSON json, JsonFactory jf, TreeCodec treeCodec)
           
 
Method Summary
protected  void _checkResultType(Class<?> valueType, Object ob)
           
protected  TreeCodec _checkTreeCodec()
           
protected  JSONObjectException _noTypeReference()
           
 TreeNode createArrayNode()
           
 TreeNode createObjectNode()
           
 JsonFactory getFactory()
           
 JsonFactory getJsonFactory()
          Deprecated. 
<T extends TreeNode>
T
readTree(JsonParser jp)
           
<T> T
readValue(JsonParser jp, Class<T> valueType)
           
<T> T
readValue(JsonParser jp, ResolvedType valueType)
           
<T> T
readValue(JsonParser jp, TypeReference<?> valueTypeRef)
           
<T> Iterator<T>
readValues(JsonParser jp, Class<T> valueType)
           
<T> Iterator<T>
readValues(JsonParser jp, ResolvedType valueType)
           
<T> Iterator<T>
readValues(JsonParser jp, TypeReference<?> valueTypeRef)
           
 JsonParser treeAsTokens(TreeNode n)
           
<T> T
treeToValue(TreeNode n, Class<T> valueType)
           
 void writeTree(JsonGenerator jg, TreeNode tree)
           
 void writeValue(JsonGenerator jgen, Object value)
           
 
Methods inherited from class com.fasterxml.jackson.core.ObjectCodec
version
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_json

protected final JSON _json

_jsonFactory

protected final JsonFactory _jsonFactory

_treeCodec

protected final TreeCodec _treeCodec
Constructor Detail

JSONAsObjectCodec

public JSONAsObjectCodec(JSON json)

JSONAsObjectCodec

public JSONAsObjectCodec(JSON json,
                         JsonFactory jf)

JSONAsObjectCodec

public JSONAsObjectCodec(JSON json,
                         JsonFactory jf,
                         TreeCodec treeCodec)
Method Detail

readValue

public <T> T readValue(JsonParser jp,
                       Class<T> valueType)
            throws IOException,
                   JsonProcessingException
Specified by:
readValue in class ObjectCodec
Throws:
IOException
JsonProcessingException

readValue

public <T> T readValue(JsonParser jp,
                       TypeReference<?> valueTypeRef)
            throws IOException,
                   JsonProcessingException
Specified by:
readValue in class ObjectCodec
Throws:
IOException
JsonProcessingException

readValue

public <T> T readValue(JsonParser jp,
                       ResolvedType valueType)
            throws IOException,
                   JsonProcessingException
Specified by:
readValue in class ObjectCodec
Throws:
IOException
JsonProcessingException

readValues

public <T> Iterator<T> readValues(JsonParser jp,
                                  Class<T> valueType)
                       throws IOException,
                              JsonProcessingException
Specified by:
readValues in class ObjectCodec
Throws:
IOException
JsonProcessingException

readValues

public <T> Iterator<T> readValues(JsonParser jp,
                                  TypeReference<?> valueTypeRef)
                       throws IOException,
                              JsonProcessingException
Specified by:
readValues in class ObjectCodec
Throws:
IOException
JsonProcessingException

readValues

public <T> Iterator<T> readValues(JsonParser jp,
                                  ResolvedType valueType)
                       throws IOException,
                              JsonProcessingException
Specified by:
readValues in class ObjectCodec
Throws:
IOException
JsonProcessingException

_noTypeReference

protected JSONObjectException _noTypeReference()

writeValue

public void writeValue(JsonGenerator jgen,
                       Object value)
                throws IOException,
                       JsonProcessingException
Specified by:
writeValue in class ObjectCodec
Throws:
IOException
JsonProcessingException

createObjectNode

public TreeNode createObjectNode()
Specified by:
createObjectNode in class ObjectCodec

createArrayNode

public TreeNode createArrayNode()
Specified by:
createArrayNode in class ObjectCodec

readTree

public <T extends TreeNode> T readTree(JsonParser jp)
                            throws IOException,
                                   JsonProcessingException
Specified by:
readTree in class ObjectCodec
Throws:
IOException
JsonProcessingException

writeTree

public void writeTree(JsonGenerator jg,
                      TreeNode tree)
               throws IOException,
                      JsonProcessingException
Specified by:
writeTree in class ObjectCodec
Throws:
IOException
JsonProcessingException

treeAsTokens

public JsonParser treeAsTokens(TreeNode n)
Specified by:
treeAsTokens in class ObjectCodec

treeToValue

public <T> T treeToValue(TreeNode n,
                         Class<T> valueType)
              throws JsonProcessingException
Specified by:
treeToValue in class ObjectCodec
Throws:
JsonProcessingException

getFactory

public JsonFactory getFactory()
Overrides:
getFactory in class ObjectCodec

getJsonFactory

@Deprecated
public JsonFactory getJsonFactory()
Deprecated. 

Overrides:
getJsonFactory in class ObjectCodec

_checkTreeCodec

protected TreeCodec _checkTreeCodec()

_checkResultType

protected void _checkResultType(Class<?> valueType,
                                Object ob)
                         throws JSONObjectException
Throws:
JSONObjectException


Copyright © 2016 FasterXML. All rights reserved.