/** * Method to called to create value instance from JSON Object using * an intermediate "delegate" value to pass to createor method */ public Object createUsingDelegate(DeserializationContext ctxt, Object delegate) throws IOException { return ctxt.handleMissingInstantiator(getValueClass(), this, null, "no delegate creator specified"); }
public Object createFromInt(DeserializationContext ctxt, int value) throws IOException { return ctxt.handleMissingInstantiator(getValueClass(), this, null, "no int/Int-argument constructor/factory method to deserialize from Number value (%s)", value); }
/** * Method to called to create value instance from JSON Array using * an intermediate "delegate" value to pass to createor method */ public Object createUsingArrayDelegate(DeserializationContext ctxt, Object delegate) throws IOException { return ctxt.handleMissingInstantiator(getValueClass(), this, null, "no array delegate creator specified"); }
public Object createFromLong(DeserializationContext ctxt, long value) throws IOException { return ctxt.handleMissingInstantiator(getValueClass(), this, null, "no long/Long-argument constructor/factory method to deserialize from Number value (%s)", value); }
public Object createFromBoolean(DeserializationContext ctxt, boolean value) throws IOException { return ctxt.handleMissingInstantiator(getValueClass(), this, null, "no boolean/Boolean-argument constructor/factory method to deserialize from boolean value (%s)", value); }
public Object createFromDouble(DeserializationContext ctxt, double value) throws IOException { return ctxt.handleMissingInstantiator(getValueClass(), this, null, "no double/Double-argument constructor/factory method to deserialize from Number value (%s)", value); }
/** * Method called to create value instance from JSON Object when * instantiation arguments are passed; this is done, for example when passing information * specified with "Creator" annotations. *<p> * This method is called if {@link #getFromObjectArguments} returns * a non-empty List of arguments. */ public Object createFromObjectWith(DeserializationContext ctxt, Object[] args) throws IOException { // sanity check; shouldn't really get called if no Creator specified return ctxt.handleMissingInstantiator(getValueClass(), this, null, "no creator with arguments specified"); }
/** * Method called to create value instance from a JSON value when * no data needs to passed to creator (constructor, factory method); * typically this will call the default constructor of the value object. * It will only be used if more specific creator methods are not * applicable; hence "default". *<p> * This method is called if {@link #getFromObjectArguments} returns * null or empty List. */ public Object createUsingDefault(DeserializationContext ctxt) throws IOException { return ctxt.handleMissingInstantiator(getValueClass(), this, null, "no default no-arguments constructor found"); }
@Override public Object deserialize(JsonParser p, DeserializationContext ctxt) throws IOException { // 16-Oct-2016, tatu: Let's pass non-null value instantiator so that we will // get proper exception type; needed to establish there are no creators // (since without ValueInstantiator this would not be known for certain) ValueInstantiator bogus = new ValueInstantiator.Base(_baseType); return ctxt.handleMissingInstantiator(_baseType.getRawClass(), bogus, p, "abstract types either need to be mapped to concrete types, have custom deserializer, or contain additional type information"); }
/** * @since 2.4 (demoted from <code>StdValueInstantiator</code>) */ protected Object _createFromStringFallbacks(DeserializationContext ctxt, String value) throws IOException { /* 28-Sep-2011, tatu: Ok this is not clean at all; but since there are legacy * systems that expect conversions in some cases, let's just add a minimal * patch (note: same could conceivably be used for numbers too). */ if (canCreateFromBoolean()) { String str = value.trim(); if ("true".equals(str)) { return createFromBoolean(ctxt, true); } if ("false".equals(str)) { return createFromBoolean(ctxt, false); } } // also, empty Strings might be accepted as null Object... if (value.length() == 0) { if (ctxt.isEnabled(DeserializationFeature.ACCEPT_EMPTY_STRING_AS_NULL_OBJECT)) { return null; } } return ctxt.handleMissingInstantiator(getValueClass(), this, ctxt.getParser(), "no String-argument constructor/factory method to deserialize from String value ('%s')", value); }
protected EnumMap<?,?> constructMap(DeserializationContext ctxt) throws JsonMappingException { if (_valueInstantiator == null) { return new EnumMap(_enumClass); } try { if (!_valueInstantiator.canCreateUsingDefault()) { return (EnumMap<?,?>) ctxt.handleMissingInstantiator(handledType(), getValueInstantiator(), null, "no default constructor found"); } return (EnumMap<?,?>) _valueInstantiator.createUsingDefault(ctxt); } catch (IOException e) { return ClassUtil.throwAsMappingException(ctxt, e); } }
protected Object deserializeFromObjectUsingNonDefault(JsonParser p, DeserializationContext ctxt) throws IOException { final JsonDeserializer<Object> delegateDeser = _delegateDeserializer(); if (delegateDeser != null) { return _valueInstantiator.createUsingDelegate(ctxt, delegateDeser.deserialize(p, ctxt)); } if (_propertyBasedCreator != null) { return _deserializeUsingPropertyBased(p, ctxt); } // 25-Jan-2017, tatu: We do not actually support use of Creators for non-static // inner classes -- with one and only one exception; that of default constructor! // -- so let's indicate it Class<?> raw = _beanType.getRawClass(); if (ClassUtil.isNonStaticInnerClass(raw)) { return ctxt.handleMissingInstantiator(raw, null, p, "can only instantiate non-static inner class by using default, no-argument constructor"); } return ctxt.handleMissingInstantiator(raw, getValueInstantiator(), p, "cannot deserialize from Object value (no delegate- or property-based Creator)"); }
return (Map<Object,Object> ) ctxt.handleMissingInstantiator(getMapClass(), getValueInstantiator(), p, "no default constructor found");
return ctxt.handleMissingInstantiator(handledType(), getValueInstantiator(), p, "abstract type (need to add/enable type information?)"); return ctxt.handleMissingInstantiator(handledType(), getValueInstantiator(), p, "Throwable needs a default contructor, a single-String-arg constructor; or explicit @JsonCreator");
delegateDeser.deserialize(p, ctxt)); return ctxt.handleMissingInstantiator(handledType(), getValueInstantiator(), p, "no suitable creator method found to deserialize from Number value (%s)", p.getNumberValue());
return ctxt.handleMissingInstantiator(handledType(), getValueInstantiator(), p, "no suitable creator method found to deserialize from Number value (%s)", p.getNumberValue());
/** * Method to called to create value instance from JSON Array using * an intermediate "delegate" value to pass to createor method */ public Object createUsingArrayDelegate(DeserializationContext ctxt, Object delegate) throws IOException { return ctxt.handleMissingInstantiator(getValueClass(), this, null, "no array delegate creator specified"); }
@Override public Object deserialize(JsonParser p, DeserializationContext ctxt) throws IOException { // 16-Oct-2016, tatu: Let's pass non-null value instantiator so that we will // get proper exception type; needed to establish there are no creators // (since without ValueInstantiator this would not be known for certain) ValueInstantiator bogus = new ValueInstantiator.Base(_baseType); return ctxt.handleMissingInstantiator(_baseType.getRawClass(), bogus, p, "abstract types either need to be mapped to concrete types, have custom deserializer, or contain additional type information"); }
public Object createFromLong(DeserializationContext ctxt, long value) throws IOException { return ctxt.handleMissingInstantiator(getValueClass(), ctxt.getParser(), "no long/Long-argument constructor/factory method to deserialize from Number value (%s)", value); }
public Object createFromDouble(DeserializationContext ctxt, double value) throws IOException { return ctxt.handleMissingInstantiator(getValueClass(), ctxt.getParser(), "no double/Double-argument constructor/factory method to deserialize from Number value (%s)", value); }