Class 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 Detail

      • _json

        protected final JSON _json
      • _jsonFactory

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

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

      • 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 Detail

      • 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 jp,
                               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 jp,
                               com.fasterxml.jackson.core.type.TypeReference<?> 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 jp,
                               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 jp,
                                          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 jp,
                                          com.fasterxml.jackson.core.type.TypeReference<?> 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 jp,
                                          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
      • 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
      • 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()