Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  package com.fasterxml.jackson.core;
  
  import java.util.Iterator;
  
Abstract class that defines the interface that JsonParser and JsonGenerator use to serialize and deserialize regular Java objects (POJOs aka Beans).

The standard implementation of this class is com.fasterxml.jackson.databind.ObjectMapper, defined in the "jackson-databind".

 
 public abstract class ObjectCodec
 {
     protected ObjectCodec() { }
 
     /*
     /**********************************************************
     /* API for de-serialization (JSON-to-Object)
     /**********************************************************
      */

    
Method to deserialize JSON content into a non-container type (it can be an array type, however): typically a bean, array or a wrapper type (like java.lang.Boolean).

Note: this method should NOT be used if the result type is a container (java.util.Collection or java.util.Map. The reason is that due to type erasure, key and value types can not be introspected when using this method.

 
     public abstract <T> T readValue(JsonParser jpClass<T> valueType)
         throws IOExceptionJsonProcessingException;

    
Method to deserialize JSON content into a Java type, reference to which is passed as argument. Type is passed using so-called "super type token" and specifically needs to be used if the root type is a parameterized (generic) container type.
 
     public abstract <T> T readValue(JsonParser jpTypeReference<?> valueTypeRef)
         throws IOExceptionJsonProcessingException;

    
Method to deserialize JSON content into a POJO, type specified with fully resolved type object (so it can be a generic type, including containers like java.util.Collection and java.util.Map).
 
     public abstract <T> T readValue(JsonParser jpResolvedType valueType)
         throws IOExceptionJsonProcessingException;

    
Method to deserialize JSON content as tree expressed using set of TreeNode instances. Returns root of the resulting tree (where root can consist of just a single node if the current event is a value event, not container).
 
     public abstract <T extends TreeNode> T readTree(JsonParser jp)
         throws IOExceptionJsonProcessingException;

    
Method for reading sequence of Objects from parser stream, all with same specified value type.
 
     public abstract <T> Iterator<T> readValues(JsonParser jpClass<T> valueType)
         throws IOExceptionJsonProcessingException;

    
Method for reading sequence of Objects from parser stream, all with same specified value type.
 
     public abstract <T> Iterator<T> readValues(JsonParser jpTypeReference<?> valueTypeRef)
         throws IOExceptionJsonProcessingException;
    
    
Method for reading sequence of Objects from parser stream, all with same specified value type.
 
     public abstract <T> Iterator<T> readValues(JsonParser jpResolvedType valueType)
         throws IOExceptionJsonProcessingException;
     
     /*
     /**********************************************************
     /* API for serialization (Object-to-JSON)
     /**********************************************************
      */

    
Method to serialize given Java Object, using generator provided.
    public abstract void writeValue(JsonGenerator jgenObject value)
        throws IOExceptionJsonProcessingException;
    /*
    /**********************************************************
    /* API for Tree Model handling
    /**********************************************************
     */

    
Method for construct root level Object nodes for Tree Model instances.
    public abstract TreeNode createObjectNode();

    
Method for construct root level Array nodes for Tree Model instances.
    public abstract TreeNode createArrayNode();

    
Method for constructing a JsonParser for reading contents of a JSON tree, as if it was external serialized JSON content.
    public abstract JsonParser treeAsTokens(TreeNode n);

    
Convenience method for converting given JSON tree into instance of specified value type. This is equivalent to first constructing a JsonParser to iterate over contents of the tree, and using that parser for data binding.
    public abstract <T> T treeToValue(TreeNode nClass<T> valueType)
        throws JsonProcessingException;
    /*
    /**********************************************************
    /* Basic accessors
    /**********************************************************
     */

    

Deprecated:
Since 2.1: Use getFactory() instead.
    @Deprecated
    public abstract JsonFactory getJsonFactory();

    
Accessor for finding underlying data format factory (JsonFactory) codec will use for data binding.

Since:
2.1
    public JsonFactory getFactory() {
        return getJsonFactory();
    }
New to GrepCode? Check out our FAQ X