Package com.fasterxml.jackson.databind.deser

Examples of com.fasterxml.jackson.databind.deser.SettableBeanProperty


                    continue;
                }
                // but not just one
                throw ctxt.mappingException("Missing external type id property '"+_properties[i].getTypePropertyName());
            } else if (_tokens[i] == null) {
                SettableBeanProperty prop = _properties[i].getProperty();
                throw ctxt.mappingException("Missing property '"+prop.getName()+"' for external type id '"+_properties[i].getTypePropertyName());
            }
            _deserialize(jp, ctxt, bean, i);
        }
        return bean;
    }
View Full Code Here


    }

    public void inject(SettableBeanProperty[] injectableProperties)
    {
        for (int i = 0, len = injectableProperties.length; i < len; ++i) {
            SettableBeanProperty prop = injectableProperties[i];
            if (prop != null) {
                // null since there is no POJO yet
                _creatorParameters[i] = _context.findInjectableValue(prop.getInjectableValueId(),
                        prop, null);
            }
        }
    }
View Full Code Here

                 */
                JsonToken t = tokens.firstToken();
                if (t != null && t.isScalarValue()) {
                    JsonParser buffered = tokens.asParser(jp);
                    buffered.nextToken();
                    SettableBeanProperty extProp = _properties[i].getProperty();
                    Object result = TypeDeserializer.deserializeIfNatural(buffered, ctxt, extProp.getType());
                    if (result != null) {
                        extProp.set(bean, result);
                        continue;
                    }
                    // 26-Oct-2012, tatu: As per [Issue#94], must allow use of 'defaultImpl'
                    if (!_properties[i].hasDefaultType()) {
                        throw ctxt.mappingException("Missing external type id property '"+_properties[i].getTypePropertyName()+"'");
                    }
                    typeId = _properties[i].getDefaultTypeId();
                }
            } else if (_tokens[i] == null) {
                SettableBeanProperty prop = _properties[i].getProperty();
                throw ctxt.mappingException("Missing property '"+prop.getName()+"' for external type id '"+_properties[i].getTypePropertyName());
            }
            _deserializeAndSet(jp, ctxt, bean, i, typeId);
        }
        return bean;
    }
View Full Code Here

                if (!_properties[i].hasDefaultType()) {
                    throw ctxt.mappingException("Missing external type id property '"+_properties[i].getTypePropertyName()+"'");
                }
                typeId = _properties[i].getDefaultTypeId();
            } else if (_tokens[i] == null) {
                SettableBeanProperty prop = _properties[i].getProperty();
                throw ctxt.mappingException("Missing property '"+prop.getName()+"' for external type id '"+_properties[i].getTypePropertyName());
            }
            values[i] = _deserialize(jp, ctxt, i, typeId);
        }
        // second: fill in creator properties:
        for (int i = 0; i < len; ++i) {
            SettableBeanProperty prop = _properties[i].getProperty();
            if (creator.findCreatorProperty(prop.getName()) != null) {
                buffer.assignParameter(prop.getCreatorIndex(), values[i]);
            }
        }
        Object bean = creator.build(ctxt, buffer);
        // third: assign non-creator properties
        for (int i = 0; i < len; ++i) {
            SettableBeanProperty prop = _properties[i].getProperty();
            if (creator.findCreatorProperty(prop.getName()) == null) {
                prop.set(bean, values[i]);
            }
        }
        return bean;
    }
View Full Code Here

    }

    public void inject(SettableBeanProperty[] injectableProperties)
    {
        for (int i = 0, len = injectableProperties.length; i < len; ++i) {
            SettableBeanProperty prop = injectableProperties[i];
            if (prop != null) {
                // null since there is no POJO yet
                _creatorParameters[i] = _context.findInjectableValue(prop.getInjectableValueId(),
                        prop, null);
            }
        }
    }
View Full Code Here

        if (_objectIdReader != null) {
            if (_idValue != null) {
                ReadableObjectId roid = ctxt.findObjectId(_idValue, _objectIdReader.generator, _objectIdReader.resolver);
                roid.bindItem(bean);
                // also: may need to set a property value as well
                SettableBeanProperty idProp = _objectIdReader.idProperty;
                if (idProp != null) {
                    return idProp.setAndReturn(bean, _idValue);
                }
            } else {
                // TODO: is this an error case?
                throw ctxt.mappingException("No _idValue when handleIdValue called, on instance of "
                        +bean.getClass().getName());
View Full Code Here

        final int bcount = _buckets.length;
        Bucket[] newBuckets = new Bucket[bcount];
        System.arraycopy(_buckets, 0, newBuckets, 0, bcount);
        final String propName = newProperty.getName();
        // and then see if it's add or replace:
        SettableBeanProperty oldProp = find(newProperty.getName());
        if (oldProp == null) { // add
            // first things first: add or replace?
              // can do a straight copy, since all additions are at the front
              // and then insert the new property:
              int index = propName.hashCode() & _hashMask;
View Full Code Here

            return this;
        }
        Iterator<SettableBeanProperty> it = iterator();
        ArrayList<SettableBeanProperty> newProps = new ArrayList<SettableBeanProperty>();
        while (it.hasNext()) {
            SettableBeanProperty prop = it.next();
            String newName = transformer.transform(prop.getName());
            prop = prop.withSimpleName(newName);
            JsonDeserializer<?> deser = prop.getValueDeserializer();
            if (deser != null) {
                @SuppressWarnings("unchecked")
                JsonDeserializer<Object> newDeser = (JsonDeserializer<Object>)
                    deser.unwrappingDeserializer(transformer);
                if (newDeser != deser) {
                    prop = prop.withValueDeserializer(newDeser);
                }
            }
            newProps.add(prop);
        }
        // should we try to re-index? Ordering probably changed but called probably doesn't want changes...
View Full Code Here

                objectMapper, type);
        JsonDeserializer idDeserializer = null;
        JsonSerializer idSerializer = null;

        if (deserializer instanceof BeanDeserializer) {
            SettableBeanProperty property = ((BeanDeserializer) deserializer)
                    .findProperty("_id");
            if (property != null) {
                idDeserializer = property.getValueDeserializer();
            }
        }

        JsonSerializer serializer = JacksonAccessor.findValueSerializer(
                JacksonAccessor.getSerializerProvider(objectMapper), type);
View Full Code Here

        return builder;
      }

      while (properties.hasNext()) {

        SettableBeanProperty property = properties.next();
        PersistentProperty<?> persistentProperty = entity.getPersistentProperty(property.getName());

        if (!associationLinks.isLinkableAssociation(persistentProperty)) {
          continue;
        }

        UriStringDeserializer uriStringDeserializer = new UriStringDeserializer(persistentProperty, converter);

        if (persistentProperty.isCollectionLike()) {

          CollectionLikeType collectionType = config.getTypeFactory().constructCollectionLikeType(
              persistentProperty.getType(), persistentProperty.getActualType());
          CollectionValueInstantiator instantiator = new CollectionValueInstantiator(persistentProperty);
          CollectionDeserializer collectionDeserializer = new CollectionDeserializer(collectionType,
              uriStringDeserializer, null, instantiator);

          builder.addOrReplaceProperty(property.withValueDeserializer(collectionDeserializer), false);

        } else {
          builder.addOrReplaceProperty(property.withValueDeserializer(uriStringDeserializer), false);
        }
      }

      return builder;
    }
View Full Code Here

TOP

Related Classes of com.fasterxml.jackson.databind.deser.SettableBeanProperty

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.