Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  package com.fasterxml.jackson.databind.deser.impl;
  
  
This sub-class is used to handle special case of value being a non-static inner class. If so, we will have to use a special alternative for default constructor; but otherwise can delegate to regular implementation.
 
 public final class InnerClassProperty
     extends SettableBeanProperty
 {
     private static final long serialVersionUID = 1L;

    
Actual property that we use after value construction.
 
     protected final SettableBeanProperty _delegate;

    
Single-arg constructor we use for value instantiation.
 
     protected final Constructor<?> _creator;
     
     public InnerClassProperty(SettableBeanProperty delegate,
             Constructor<?> ctor)
     {
         super(delegate);
          = delegate;
          = ctor;
     }
 
     protected InnerClassProperty(InnerClassProperty srcJsonDeserializer<?> deser)
     {
         super(srcdeser);
          = src._delegate.withValueDeserializer(deser);
          = src._creator;
     }
 
     protected InnerClassProperty(InnerClassProperty srcString newName) {
         super(srcnewName);
          = src._delegate.withName(newName);
          = src._creator;
     }
 
     @Override
     public InnerClassProperty withName(String newName) {
         return new InnerClassProperty(thisnewName);
     }
 
     @Override
         return new InnerClassProperty(thisdeser);
     }
     
     // // // BeanProperty impl
     
     @Override
     public <A extends Annotation> A getAnnotation(Class<A> acls) {
         return .getAnnotation(acls);
     }
 
     @Override public AnnotatedMember getMember() {  return .getMember(); }
 
     /*
     /**********************************************************
     /* Deserialization methods
     /**********************************************************
      */
 
     @Override
     public void deserializeAndSet(JsonParser jpDeserializationContext ctxt,
             Object bean)
         throws IOExceptionJsonProcessingException
     {
         JsonToken t = jp.getCurrentToken();
         Object value;
         if (t == .) {
             value = ( == null) ? null : .nullValue(ctxt);
         } else if ( != null) {
             value = .deserializeWithType(jpctxt);
         } else  { // the usual case
             try {
                 value = .newInstance(bean);
             } catch (Exception e) {
                 ClassUtil.unwrapAndThrowAsIAE(e"Failed to instantiate class "+.getDeclaringClass().getName()+", problem: "+e.getMessage());
                 value = null;
            }
            .deserialize(jpctxtvalue);
        }
        set(beanvalue);
    }
    @Override
    		DeserializationContext ctxtObject instance)
        throws IOExceptionJsonProcessingException
    {
        return setAndReturn(instancedeserialize(jpctxt));
    }
    
    @Override
    public final void set(Object instanceObject valuethrows IOException
    {
        .set(instancevalue);
    }
    @Override
    public Object setAndReturn(Object instanceObject value)
            throws IOException
    {
    	return .setAndReturn(instancevalue);
    }
New to GrepCode? Check out our FAQ X