Class JSONAsObjectCodec

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

public class JSONAsObjectCodec extends com.fasterxml.jackson.core.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

    Fields
    Modifier and Type
    Field
    Description
    protected final JSON
     
    protected final com.fasterxml.jackson.core.JsonFactory
     
    protected final com.fasterxml.jackson.core.TreeCodec
     
  • Constructor Summary

    Constructors
    Constructor
    Description
     
    JSONAsObjectCodec(JSON json, com.fasterxml.jackson.core.JsonFactory jf)
     
    JSONAsObjectCodec(JSON json, com.fasterxml.jackson.core.JsonFactory jf, com.fasterxml.jackson.core.TreeCodec treeCodec)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    protected void
    _checkResultType(Class<?> valueType, Object ob)
     
    protected com.fasterxml.jackson.core.TreeCodec
     
     
    com.fasterxml.jackson.core.TreeNode
     
    com.fasterxml.jackson.core.TreeNode
     
    com.fasterxml.jackson.core.JsonFactory
     
    com.fasterxml.jackson.core.JsonFactory
    Deprecated.
    com.fasterxml.jackson.core.TreeNode
     
    com.fasterxml.jackson.core.TreeNode
     
    <T extends com.fasterxml.jackson.core.TreeNode>
    T
    readTree(com.fasterxml.jackson.core.JsonParser jp)
     
    <T> T
    readValue(com.fasterxml.jackson.core.JsonParser p, com.fasterxml.jackson.core.type.ResolvedType valueType)
     
    <T> T
    readValue(com.fasterxml.jackson.core.JsonParser p, com.fasterxml.jackson.core.type.TypeReference<T> valueTypeRef)
     
    <T> T
    readValue(com.fasterxml.jackson.core.JsonParser p, Class<T> valueType)
     
    <T> Iterator<T>
    readValues(com.fasterxml.jackson.core.JsonParser p, com.fasterxml.jackson.core.type.ResolvedType valueType)
     
    <T> Iterator<T>
    readValues(com.fasterxml.jackson.core.JsonParser p, com.fasterxml.jackson.core.type.TypeReference<T> valueTypeRef)
     
    <T> Iterator<T>
    readValues(com.fasterxml.jackson.core.JsonParser p, Class<T> valueType)
     
    com.fasterxml.jackson.core.JsonParser
    treeAsTokens(com.fasterxml.jackson.core.TreeNode n)
     
    <T> T
    treeToValue(com.fasterxml.jackson.core.TreeNode n, Class<T> valueType)
     
    com.fasterxml.jackson.core.Version
     
    void
    writeTree(com.fasterxml.jackson.core.JsonGenerator jg, com.fasterxml.jackson.core.TreeNode tree)
     
    void
    writeValue(com.fasterxml.jackson.core.JsonGenerator jgen, Object value)
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • _json

      protected final JSON _json
    • _jsonFactory

      protected final com.fasterxml.jackson.core.JsonFactory _jsonFactory
    • _treeCodec

      protected final com.fasterxml.jackson.core.TreeCodec _treeCodec
  • Constructor Details

    • JSONAsObjectCodec

      public JSONAsObjectCodec(JSON json)
    • JSONAsObjectCodec

      public JSONAsObjectCodec(JSON json, com.fasterxml.jackson.core.JsonFactory jf)
    • JSONAsObjectCodec

      public JSONAsObjectCodec(JSON json, com.fasterxml.jackson.core.JsonFactory jf, com.fasterxml.jackson.core.TreeCodec treeCodec)
  • Method Details

    • version

      public com.fasterxml.jackson.core.Version version()
      Specified by:
      version in interface com.fasterxml.jackson.core.Versioned
      Specified by:
      version in class com.fasterxml.jackson.core.ObjectCodec
    • readValue

      public <T> T readValue(com.fasterxml.jackson.core.JsonParser p, Class<T> valueType) throws IOException, com.fasterxml.jackson.core.JsonProcessingException
      Specified by:
      readValue in class com.fasterxml.jackson.core.ObjectCodec
      Throws:
      IOException
      com.fasterxml.jackson.core.JsonProcessingException
    • readValue

      public <T> T readValue(com.fasterxml.jackson.core.JsonParser p, com.fasterxml.jackson.core.type.TypeReference<T> valueTypeRef) throws IOException, com.fasterxml.jackson.core.JsonProcessingException
      Specified by:
      readValue in class com.fasterxml.jackson.core.ObjectCodec
      Throws:
      IOException
      com.fasterxml.jackson.core.JsonProcessingException
    • readValue

      public <T> T readValue(com.fasterxml.jackson.core.JsonParser p, com.fasterxml.jackson.core.type.ResolvedType valueType) throws IOException, com.fasterxml.jackson.core.JsonProcessingException
      Specified by:
      readValue in class com.fasterxml.jackson.core.ObjectCodec
      Throws:
      IOException
      com.fasterxml.jackson.core.JsonProcessingException
    • readValues

      public <T> Iterator<T> readValues(com.fasterxml.jackson.core.JsonParser p, Class<T> valueType) throws IOException, com.fasterxml.jackson.core.JsonProcessingException
      Specified by:
      readValues in class com.fasterxml.jackson.core.ObjectCodec
      Throws:
      IOException
      com.fasterxml.jackson.core.JsonProcessingException
    • readValues

      public <T> Iterator<T> readValues(com.fasterxml.jackson.core.JsonParser p, com.fasterxml.jackson.core.type.TypeReference<T> valueTypeRef) throws IOException, com.fasterxml.jackson.core.JsonProcessingException
      Specified by:
      readValues in class com.fasterxml.jackson.core.ObjectCodec
      Throws:
      IOException
      com.fasterxml.jackson.core.JsonProcessingException
    • readValues

      public <T> Iterator<T> readValues(com.fasterxml.jackson.core.JsonParser p, com.fasterxml.jackson.core.type.ResolvedType valueType) throws IOException, com.fasterxml.jackson.core.JsonProcessingException
      Specified by:
      readValues in class com.fasterxml.jackson.core.ObjectCodec
      Throws:
      IOException
      com.fasterxml.jackson.core.JsonProcessingException
    • _noTypeReference

      protected JSONObjectException _noTypeReference()
    • writeValue

      public void writeValue(com.fasterxml.jackson.core.JsonGenerator jgen, Object value) throws IOException, com.fasterxml.jackson.core.JsonProcessingException
      Specified by:
      writeValue in class com.fasterxml.jackson.core.ObjectCodec
      Throws:
      IOException
      com.fasterxml.jackson.core.JsonProcessingException
    • createObjectNode

      public com.fasterxml.jackson.core.TreeNode createObjectNode()
      Specified by:
      createObjectNode in class com.fasterxml.jackson.core.ObjectCodec
    • createArrayNode

      public com.fasterxml.jackson.core.TreeNode createArrayNode()
      Specified by:
      createArrayNode in class com.fasterxml.jackson.core.ObjectCodec
    • missingNode

      public com.fasterxml.jackson.core.TreeNode missingNode()
      Overrides:
      missingNode in class com.fasterxml.jackson.core.TreeCodec
    • nullNode

      public com.fasterxml.jackson.core.TreeNode nullNode()
      Overrides:
      nullNode in class com.fasterxml.jackson.core.TreeCodec
    • readTree

      public <T extends com.fasterxml.jackson.core.TreeNode> T readTree(com.fasterxml.jackson.core.JsonParser jp) throws IOException, com.fasterxml.jackson.core.JsonProcessingException
      Specified by:
      readTree in class com.fasterxml.jackson.core.ObjectCodec
      Throws:
      IOException
      com.fasterxml.jackson.core.JsonProcessingException
    • writeTree

      public void writeTree(com.fasterxml.jackson.core.JsonGenerator jg, com.fasterxml.jackson.core.TreeNode tree) throws IOException, com.fasterxml.jackson.core.JsonProcessingException
      Specified by:
      writeTree in class com.fasterxml.jackson.core.ObjectCodec
      Throws:
      IOException
      com.fasterxml.jackson.core.JsonProcessingException
    • treeAsTokens

      public com.fasterxml.jackson.core.JsonParser treeAsTokens(com.fasterxml.jackson.core.TreeNode n)
      Specified by:
      treeAsTokens in class com.fasterxml.jackson.core.ObjectCodec
    • treeToValue

      public <T> T treeToValue(com.fasterxml.jackson.core.TreeNode n, Class<T> valueType) throws com.fasterxml.jackson.core.JsonProcessingException
      Specified by:
      treeToValue in class com.fasterxml.jackson.core.ObjectCodec
      Throws:
      com.fasterxml.jackson.core.JsonProcessingException
    • getFactory

      public com.fasterxml.jackson.core.JsonFactory getFactory()
      Overrides:
      getFactory in class com.fasterxml.jackson.core.ObjectCodec
    • getJsonFactory

      @Deprecated public com.fasterxml.jackson.core.JsonFactory getJsonFactory()
      Deprecated.
      Overrides:
      getJsonFactory in class com.fasterxml.jackson.core.ObjectCodec
    • _checkTreeCodec

      protected com.fasterxml.jackson.core.TreeCodec _checkTreeCodec()
    • _checkResultType

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