Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  package com.fasterxml.jackson.databind.deser.impl;
Simple container used for temporarily buffering a set of PropertyValues. Using during construction of beans (and Maps) that use Creators, and hence need buffering before instance (that will have properties to assign values to) is constructed.
 public final class PropertyValueBuffer
     protected final JsonParser _parser;
     protected final DeserializationContext _context;
Buffer used for storing creator parameters for constructing instance
     protected final Object[] _creatorParameters;
     protected final ObjectIdReader _objectIdReader;
Number of creator parameters we are still missing.

NOTE: assumes there are no duplicates, for now.

     private int _paramsNeeded;
If we get non-creator parameters before or between creator parameters, those need to be buffered. Buffer is just a simple linked list
     private PropertyValue _buffered;

In case there is an Object Id property to handle, this is the value we have for it.
     private Object _idValue;
     public PropertyValueBuffer(JsonParser jpDeserializationContext ctxtint paramCount,
             ObjectIdReader oir)
          = jp;
          = ctxt;
          = paramCount;
          = oir;
          = new Object[paramCount];
     public void inject(SettableBeanProperty[] injectableProperties)
         for (int i = 0, len = injectableProperties.lengthi < len; ++i) {
             SettableBeanProperty prop = injectableProperties[i];
             if (prop != null) {
                 // null since there is no POJO yet
                 [i] = .findInjectableValue(prop.getInjectableValueId(),

defaults If any of parameters requires nulls to be replaced with a non-null object (usually primitive types), this is a non-null array that has such replacement values (and nulls for cases where nulls are ok)
     protected final Object[] getParameters(Object[] defaults)
         if (defaults != null) {
             for (int i = 0, len = .i < len; ++i) {
                 if ([i] == null) {
                     Object value = defaults[i];
                     if (value != null) {
                         [i] = value;
         return ;

Helper method called to see if given non-creator property is the "id property"; and if so, handle appropriately.

    public boolean readIdProperty(String propNamethrows IOException
        if (( != null) && propName.equals(.)) {
            return true;
        return false;

Helper method called to handle Object Id value collected earlier, if any
    public Object handleIdValue(final DeserializationContext ctxtObject bean)
        throws IOException
        if ( != null) {
            if ( != null) {
                ReadableObjectId roid = ctxt.findObjectId(.);
                // also: may need to set a property value as well
                SettableBeanProperty idProp = .;
                if (idProp != null) {
                    return idProp.setAndReturn(bean);
            } else {
                // TODO: is this an error case?
        return bean;
    protected PropertyValue buffered() { return ; }
    public boolean isComplete() { return  <= 0; }

True if we have received all creator parameters
    public boolean assignParameter(int indexObject value) {
        [index] = value;
        return -- <= 0;
    public void bufferProperty(SettableBeanProperty propObject value) {
         = new PropertyValue.Regular(valueprop);
    public void bufferAnyProperty(SettableAnyProperty propString propNameObject value) {
         = new PropertyValue.Any(valueproppropName);
    public void bufferMapProperty(Object keyObject value) {
         = new PropertyValue.Map(valuekey);
New to GrepCode? Check out our FAQ X