Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  package com.fasterxml.jackson.databind.deser.std;
  
  
Base class that simplifies implementations of com.fasterxml.jackson.databind.JsonDeserializers that mostly delegate functionality to another deserializer implementation (possibly forming a chaing of deserializers delegating functionality in some cases)

Since:
2.1
 
 public abstract class DelegatingDeserializer
     extends StdDeserializer<Object>
 {
     protected final JsonDeserializer<?> _delegatee;
     
     /*
     /**********************************************************************
     /* Construction
     /**********************************************************************
      */
 
     public DelegatingDeserializer(JsonDeserializer<?> delegatee)
     {
         super(_figureType(delegatee));
          = delegatee;
     }
 
     protected abstract JsonDeserializer<?> newDelegatingInstance(JsonDeserializer<?> newDelegatee);
     
     private static Class<?> _figureType(JsonDeserializer<?> deser)
     {
         if (deser instanceof StdDeserializer<?>) {
             return ((StdDeserializer<?>) deser).getValueClass();
         }
         return Object.class;
     }
     
     /*
     /**********************************************************************
     /* Overridden methods for contextualization, resolving
     /**********************************************************************
      */
 
     public void resolve(DeserializationContext ctxtthrows JsonMappingException {
         if ( instanceof ResolvableDeserializer) {
             ((ResolvableDeserializer).resolve(ctxt);
         }
     }
 
             BeanProperty property)
         throws JsonMappingException
     {
         JsonDeserializer<?> del = ;
         if (del instanceof ContextualDeserializer) {
             del = ((ContextualDeserializerdel).createContextual(ctxtproperty);
         }
         return _createContextual(ctxtpropertydel);
     }
 
             BeanProperty propertyJsonDeserializer<?> newDelegatee)
     {
         if (newDelegatee == ) {
             return this;
         }
         return newDelegatingInstance(newDelegatee);
     }
 
     /*
     /**********************************************************************
     /* Overridden deserialization methods
     /**********************************************************************
      */
 
     @Override
     public Object deserialize(JsonParser jpDeserializationContext ctxt)
         throws IOExceptionJsonProcessingException
     {
         return .deserialize(jp,  ctxt);
     }
 
     @SuppressWarnings("unchecked")
     @Override
     public Object deserialize(JsonParser jpDeserializationContext ctxt,
             Object intoValue)
         throws IOExceptionJsonProcessingException
     {
        return ((JsonDeserializer<Object>)).deserialize(jpctxtintoValue);
    }
    @Override
            TypeDeserializer typeDeserializer)
        throws IOExceptionJsonProcessingException
    {
        return .deserializeWithType(jpctxttypeDeserializer);
    }
    /*
    /**********************************************************************
    /* Overridden other methods
    /**********************************************************************
     */
    @Override
    public JsonDeserializer<?> replaceDelegatee(JsonDeserializer<?> delegatee)
    {
        if (delegatee == ) {
            return this;
        }
        return newDelegatingInstance(delegatee);
    }
    @Override
    public Object getNullValue() { return .getNullValue(); }
    @Override
    public Object getEmptyValue() { return .getEmptyValue(); }
    @Override
    
    @Override
    public boolean isCachable() { return false; }
    @Override
    @Override
    public JsonDeserializer<?> getDelegatee() {
        return ;
    }
New to GrepCode? Check out our FAQ X