Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
 package com.fasterxml.jackson.databind;
 import java.util.*;

Abstract class that defines API for objects that provide value to "inject" during deserialization. An instance of this object
 public abstract class InjectableValues
Method called to find value identified by id valueId to inject as value of specified property during deserialization, passing POJO instance in which value will be injected if it is available (will be available when injected via field or setter; not available when injected via constructor or factory method argument).

valueId Object that identifies value to inject; may be a simple name or more complex identifier object, whatever provider needs
ctxt Deserialization context
forProperty Bean property in which value is to be injected
beanInstance Bean instance that contains property to inject, if available; null if bean has not yet been constructed.
    public abstract Object findInjectableValue(Object valueId,
            DeserializationContext ctxtBeanProperty forProperty,
            Object beanInstance);
    /* Standard implementation

Simple standard implementation which uses a simple Map to store values to inject, identified by simple String keys.
    public static class Std
        extends InjectableValues
        private static final long serialVersionUID = 1L;
        protected final Map<String,Object_values;
        public Std() {
            this(new HashMap<String,Object>());
        public Std(Map<String,Objectvalues) {
             = values;
        public Std addValue(String keyObject value)
            return this;
        public Std addValue(Class<?> classKeyObject value)
            .put(classKey.getName(), value);
            return this;
        public Object findInjectableValue(Object valueId,
                DeserializationContext ctxtBeanProperty forProperty,
                Object beanInstance)
            if (!(valueId instanceof String)) {
                String type = (valueId == null) ? "[null]" : valueId.getClass().getName();
                throw new IllegalArgumentException("Unrecognized inject value id type ("+type+"), expecting String");
            String key = (StringvalueId;
            Object ob = .get(key);
            if (ob == null && !.containsKey(key)) {
                throw new IllegalArgumentException("No injectable id with value '"+key+"' found (for property '"
            return ob;
New to GrepCode? Check out our FAQ X