Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  package com.fasterxml.jackson.databind.deser.impl;
  
  import java.util.Map;
  
Wrapper property that is used to handle managed (forward) properties (see [JACKSON-235] for more information). Basically just need to delegate first to actual forward property, and
 
 public final class ManagedReferenceProperty
     extends SettableBeanProperty
 {
     private static final long serialVersionUID = 1L;
 
     protected final String _referenceName;
    
    
Flag that indicates whether property to handle is a container type (array, Collection, Map) or not.
 
     protected final boolean _isContainer;
     
     protected final SettableBeanProperty _managedProperty;
 
     protected final SettableBeanProperty _backProperty;
     
             String refNameSettableBeanProperty backward,
             Annotations contextAnnotationsboolean isContainer)
     {
         super(forward.getName(), forward.getType(), forward.getValueTypeDeserializer(),
                 contextAnnotations);
          = refName;
          = forward;
          = backward;
          = isContainer;
     }
 
     {
         super(srcdeser);
          = src._referenceName;
          = src._isContainer;
          = src._managedProperty;
          = src._backProperty;
     }
 
     protected ManagedReferenceProperty(ManagedReferenceProperty srcString newName) {
         super(srcnewName);
          = src._referenceName;
          = src._isContainer;
          = src._managedProperty;
          = src._backProperty;
     }
 
     @Override
     public ManagedReferenceProperty withName(String newName) {
         return new ManagedReferenceProperty(thisnewName);
     }
     
     @Override
         return new ManagedReferenceProperty(thisdeser);
     }
     
     /*
     /**********************************************************
     /* BeanProperty impl
     /**********************************************************
      */
     
     @Override
     public <A extends Annotation> A getAnnotation(Class<A> acls) {
         return .getAnnotation(acls);
     }
 
     @Override public AnnotatedMember getMember() {  return .getMember(); }
 
     /*
     /**********************************************************
     /* Overridden methods
     /**********************************************************
      */
 
     @Override
     public void deserializeAndSet(JsonParser jpDeserializationContext ctxt,
                                   Object instance)
         throws IOExceptionJsonProcessingException
    {
        set(instance.deserialize(jpctxt));
    }
    @Override
    		DeserializationContext ctxtObject instance)
        throws IOExceptionJsonProcessingException
    {
        return setAndReturn(instancedeserialize(jpctxt));
    }
    
    @Override
    public final void set(Object instanceObject value)
        throws IOException
    {
    	setAndReturn(instancevalue);
    }
    @Override
    public Object setAndReturn(Object instanceObject value)
   		throws IOException
	{
    	Object result = .setAndReturn(instancevalue);
        /* And then back reference, if (and only if!) we actually have a non-null
         * reference
         */
        if (value != null) {
            if () { // ok, this gets ugly... but has to do for now
                if (value instanceof Object[]) {
                    for (Object ob : (Object[]) value) {
                        if (ob != null) {
                            .set(obinstance);                            
                        }
                    }
                } else if (value instanceof Collection<?>) {
                    for (Object ob : (Collection<?>) value) {
                        if (ob != null) {
                            .set(obinstance);                            
                        }
                    }
                } else if (value instanceof Map<?,?>) {
                    for (Object ob : ((Map<?,?>) value).values()) {
                        if (ob != null) {
                            .set(obinstance);                            
                        }
                    }
                } else {
                    throw new IllegalStateException("Unsupported container type ("+value.getClass().getName()
                            +") when resolving reference '"++"'");
                }
            } else {
                .set(valueinstance);
            }
        }
    	return result;
	}
New to GrepCode? Check out our FAQ X