protected InvalidDefinitionException(JsonParser p, String msg, BeanDescription bean, BeanPropertyDefinition prop) { super(p, msg); _type = (bean == null) ? null : bean.getType(); _beanDesc = bean; _property = prop; }
protected InvalidDefinitionException(JsonGenerator g, String msg, BeanDescription bean, BeanPropertyDefinition prop) { super(g, msg); _type = (bean == null) ? null : bean.getType(); _beanDesc = bean; _property = prop; }
/** * @deprecated Since 2.9 */ @Deprecated public BuilderBasedDeserializer(BeanDeserializerBuilder builder, BeanDescription beanDesc, BeanPropertyMap properties, Map<String, SettableBeanProperty> backRefs, Set<String> ignorableProps, boolean ignoreAllUnknown, boolean hasViews) { this(builder, beanDesc, beanDesc.getType(), // Wrong! But got no access via `BeanDeserializerBuilder` properties, backRefs, ignorableProps, ignoreAllUnknown, hasViews); }
protected AbstractDeserializer(BeanDescription beanDesc) { _baseType = beanDesc.getType(); _objectIdReader = null; _backRefProperties = null; Class<?> cls = _baseType.getRawClass(); _acceptString = cls.isAssignableFrom(String.class); _acceptBoolean = (cls == Boolean.TYPE) || cls.isAssignableFrom(Boolean.class); _acceptInt = (cls == Integer.TYPE) || cls.isAssignableFrom(Integer.class); _acceptDouble = (cls == Double.TYPE) || cls.isAssignableFrom(Double.class); }
/** * Factory method for constructing an "empty" serializer; one that * outputs no properties (but handles JSON objects properly, including * type information) */ public BeanSerializer createDummy() { return BeanSerializer.createDummy(_beanDesc.getType()); } }
/** * Constructor used by {@link BeanDeserializerBuilder}. */ public BuilderBasedDeserializer(BeanDeserializerBuilder builder, BeanDescription beanDesc, JavaType targetType, BeanPropertyMap properties, Map<String, SettableBeanProperty> backRefs, Set<String> ignorableProps, boolean ignoreAllUnknown, boolean hasViews) { super(builder, beanDesc, properties, backRefs, ignorableProps, ignoreAllUnknown, hasViews); _targetType = targetType; _buildMethod = builder.getBuildMethod(); // 05-Mar-2012, tatu: Cannot really make Object Ids work with builders, not yet anyway if (_objectIdReader != null) { throw new IllegalArgumentException("Cannot use Object Id with Builder-based deserialization (type " +beanDesc.getType()+")"); } }
/** * Method to add a property setter. Will ensure that there is no * unexpected override; if one is found will throw a * {@link IllegalArgumentException}. */ public void addProperty(SettableBeanProperty prop) { SettableBeanProperty old = _properties.put(prop.getName(), prop); if (old != null && old != prop) { // should never occur... throw new IllegalArgumentException("Duplicate property '"+prop.getName()+"' for "+_beanDesc.getType()); } }
protected void _reportUnwrappedCreatorProperty(DeserializationContext ctxt, BeanDescription beanDesc, AnnotatedParameter param) throws JsonMappingException { ctxt.reportBadDefinition(beanDesc.getType(), String.format( "Cannot define Creator parameter %d as `@JsonUnwrapped`: combination not yet supported", param.getIndex())); }
/** * @since 2.9 * * @param props Regular properties: currently only needed to support property-annotated * Object Id handling with property inclusion (needed for determining type of Object Id * to bind) */ public AbstractDeserializer(BeanDeserializerBuilder builder, BeanDescription beanDesc, Map<String, SettableBeanProperty> backRefProps, Map<String, SettableBeanProperty> props) { _baseType = beanDesc.getType(); _objectIdReader = builder.getObjectIdReader(); _backRefProperties = backRefProps; _properties = props; Class<?> cls = _baseType.getRawClass(); _acceptString = cls.isAssignableFrom(String.class); _acceptBoolean = (cls == Boolean.TYPE) || cls.isAssignableFrom(Boolean.class); _acceptInt = (cls == Integer.TYPE) || cls.isAssignableFrom(Integer.class); _acceptDouble = (cls == Double.TYPE) || cls.isAssignableFrom(Double.class); }
private void removeSuperClassAndInterfaceSubTypes(List<NamedType> types, BeanDescription bean) { Class<?> beanClass = bean.getType().getRawClass(); Class<?> superClass = beanClass.getSuperclass(); if (superClass != null && !superClass.equals(Object.class)) { removeSuperSubTypes(types, superClass); } if (!types.isEmpty()) { Class<?>[] superInterfaces = beanClass.getInterfaces(); for (Class<?> superInterface : superInterfaces) { removeSuperSubTypes(types, superInterface); if (types.isEmpty()) { break; } } } }
return new BeanSerializer(_beanDesc.getType(), this, properties, _filteredProperties);
_context.reportBadDefinition(_beanDesc.getType(), String.format("Builder class %s does not have build method (name: '%s')", _beanDesc.getBeanClass().getName(), && !rawBuildType.isAssignableFrom(rawValueType) && !rawValueType.isAssignableFrom(rawBuildType)) { _context.reportBadDefinition(_beanDesc.getType(), String.format("Build method '%s' has wrong return type (%s), not compatible with POJO type (%s)", _buildMethod.getFullName(),
BeanDescription beanDesc, ValueInstantiator defaultInstantiator) JavaType type = beanDesc.getType(); Class<?> raw = type.getRawClass();
@Override public ValueInstantiator findValueInstantiator(DeserializationConfig config, BeanDescription beanDesc, ValueInstantiator defaultInstantiator) { JavaType type = beanDesc.getType(); Class<?> raw = type.getRawClass();
BeanDescription beanDesc, ValueInstantiator defaultInstantiator) JavaType type = beanDesc.getType(); Class<?> raw = type.getRawClass();
public ValueInstantiator constructValueInstantiator(DeserializationContext ctxt) throws JsonMappingException { final DeserializationConfig config = ctxt.getConfig(); final JavaType delegateType = _computeDelegateType(ctxt, _creators[C_DELEGATE], _delegateArgs); final JavaType arrayDelegateType = _computeDelegateType(ctxt, _creators[C_ARRAY_DELEGATE], _arrayDelegateArgs); final JavaType type = _beanDesc.getType(); // 11-Jul-2016, tatu: Earlier optimization by replacing the whole // instantiator did not // work well, so let's replace by lower-level check: AnnotatedWithParams defaultCtor = StdTypeConstructor .tryToOptimize(_creators[C_DEFAULT]); StdValueInstantiator inst = new StdValueInstantiator(config, type); inst.configureFromObjectSettings(defaultCtor, _creators[C_DELEGATE], delegateType, _delegateArgs, _creators[C_PROPS], _propertyBasedArgs); inst.configureFromArraySettings(_creators[C_ARRAY_DELEGATE], arrayDelegateType, _arrayDelegateArgs); inst.configureFromStringCreator(_creators[C_STRING]); inst.configureFromIntCreator(_creators[C_INT]); inst.configureFromLongCreator(_creators[C_LONG]); inst.configureFromDoubleCreator(_creators[C_DOUBLE]); inst.configureFromBooleanCreator(_creators[C_BOOLEAN]); return inst; }
if (beanDesc.getType().isConcrete()) { _addDeserializerConstructors(ctxt, beanDesc, vchecker, intr, creators, creatorDefs);
mapType, null, mutator, PropertyMetadata.STD_OPTIONAL); } else { return ctxt.reportBadDefinition(beanDesc.getType(), String.format( "Unrecognized mutator type for any setter: %s", mutator.getClass()));
} catch (RuntimeException e) { prov.reportBadTypeDefinition(beanDesc, "Failed to construct BeanSerializer for %s: (%s) %s", beanDesc.getType(), e.getClass().getName(), e.getMessage());