@Override public JsonDeserializer<Object> createBeanDeserializer(DeserializationConfig config, DeserializerProvider p, JavaType type, BeanProperty property) throws JsonMappingException { Class<?> cls = type.getRawClass(); ClassKey key = new ClassKey(cls); // Do we have a match? if (_directClassMappings != null) { JsonDeserializer<Object> deser = _directClassMappings.get(key); if (deser != null) { return deser; } } // If not, let super class do its job return super.createBeanDeserializer(config, p, type, property); }
/** * Method used by module registration functionality, to construct a new bean * deserializer factory * with different configuration settings. * * @since 1.7 */ @Override public DeserializerFactory withConfig(DeserializerFactory.Config config) { if (_factoryConfig == config) { return this; } /* 22-Nov-2010, tatu: Handling of subtypes is tricky if we do immutable-with-copy-ctor; * and we pretty much have to here either choose between losing subtype instance * when registering additional deserializers, or losing deserializers. * Instead, let's actually just throw an error if this method is called when subtype * has not properly overridden this method; this to indicate problem as soon as possible. */ if (getClass() != BeanDeserializerFactory.class) { throw new IllegalStateException("Subtype of BeanDeserializerFactory ("+getClass().getName() +") has not properly overridden method 'withAdditionalDeserializers': can not instantiate subtype with " +"additional deserializer definitions"); } return new BeanDeserializerFactory(config); }
_addDeserializerFactoryMethods(config, beanDesc, vchecker, intr, creators); _addDeserializerConstructors(config, beanDesc, vchecker, intr, creators);
type = mapAbstractType(config, type); JsonDeserializer<Object> ad = findDeserializerFromAnnotation(config, beanDesc.getClassInfo(), property); if (ad != null) { return ad; JavaType newType = modifyTypeByAnnotation(config, beanDesc.getClassInfo(), type, null); if (newType.getRawClass() != type.getRawClass()) { type = newType; JsonDeserializer<Object> custom = _findCustomBeanDeserializer(type, config, p, beanDesc, property); if (custom != null) { return custom; return buildThrowableDeserializer(config, type, beanDesc, property); JavaType concreteType = materializeAbstractType(config, beanDesc); if (concreteType != null) { return buildBeanDeserializer(config, concreteType, beanDesc, property); JsonDeserializer<Object> deser = findStdBeanDeserializer(config, p, type, property); if (deser != null) { return deser; if (!isPotentialBeanType(type.getRawClass())) { return null; return buildBeanDeserializer(config, type, beanDesc, property);
ValueInstantiator valueInstantiator = findValueInstantiator(config, beanDesc); BeanDeserializerBuilder builder = constructBeanDeserializerBuilder(beanDesc); builder.setValueInstantiator(valueInstantiator); addBeanProps(config, beanDesc, builder); addReferenceProperties(config, beanDesc, builder); addInjectables(config, beanDesc, builder);
_handleSingleArgumentConstructor(config, beanDesc, vchecker, intr, creators, ctor, isCreator, isVisible); continue; if (name != null && name.length() > 0) { ++namedCount; properties[i] = constructCreatorProperty(config, beanDesc, name, i, param, injectId); } else if (injectId != null) { ++injectCount; properties[i] = constructCreatorProperty(config, beanDesc, name, i, param, injectId); } else if (nonAnnotatedParam == null) { nonAnnotatedParam = param;
if (isIgnorableType(config, beanDesc, type, ignoredTypes)) { SettableBeanProperty prop = constructSettableProperty(config, beanDesc, name, setter); if (prop != null) { builder.addProperty(prop); if (isIgnorableType(config, beanDesc, type, ignoredTypes)) { SettableBeanProperty prop = constructSettableProperty(config, beanDesc, name, field); if (prop != null) { builder.addProperty(prop); builder.setAnySetter(constructAnySetter(config, beanDesc, anySetter)); if (Collection.class.isAssignableFrom(rt) || Map.class.isAssignableFrom(rt)) { if (!ignored.contains(name) && !builder.hasProperty(name)) { builder.addProperty(constructSetterlessProperty(config, beanDesc, name, getter));
BeanDeserializerBuilder builder = constructBeanDeserializerBuilder(beanDesc); builder.setValueInstantiator(findValueInstantiator(config, beanDesc)); addBeanProps(config, beanDesc, builder); SettableBeanProperty prop = constructSettableProperty(config, beanDesc, "cause", am); if (prop != null) {
if (!isPotentialBeanType(type.getRawClass())) { return null; JsonDeserializer<Object> ad = findDeserializerFromAnnotation(config, beanDesc.getClassInfo()); if (ad != null) { return ad; JavaType newType = modifyTypeByAnnotation(config, beanDesc.getClassInfo(), type); if (newType.getRawClass() != type.getRawClass()) { type = newType; return buildThrowableDeserializer(config, type, beanDesc); return buildBeanDeserializer(config, type, beanDesc);
BeanDeserializerBuilder builder = constructBeanDeserializerBuilder(beanDesc); builder.setCreators(findDeserializerCreators(config, beanDesc)); addBeanProps(config, beanDesc, builder); SettableBeanProperty prop = constructSettableProperty(config, beanDesc, "cause", am); if (prop != null) { builder.addProperty(prop);
String name = en.getKey(); if (!ignored.contains(name)) { // explicit ignoral using @JsonIgnoreProperties needs to block entries SettableBeanProperty prop = constructSettableProperty(config, beanDesc, name, en.getValue()); if (prop != null) { deser.addProperty(prop); deser.setAnySetter(constructAnySetter(config, anySetter)); String name = en.getKey(); if (!ignored.contains(name)) { deser.addProperty(constructSetterlessProperty(config, name, getter)); addedProps.add(name); String name = en.getKey(); if (!ignored.contains(name)) { SettableBeanProperty prop = constructSettableProperty(config, beanDesc, name, en.getValue()); if (prop != null) { deser.addProperty(prop);
BeanDeserializerBuilder builder = constructBeanDeserializerBuilder(beanDesc); builder.setCreators(findDeserializerCreators(config, beanDesc)); addBeanProps(config, beanDesc, builder); addReferenceProperties(config, beanDesc, builder);
properties[0] = constructCreatorProperty(config, beanDesc, name, 0, param, injectId); creators.addPropertyCreator(ctor, properties); return true;
BeanDeserializer deser = constructThrowableDeserializerInstance(config, type, beanDesc); addDeserializerCreators(config, beanDesc, deser); deser.validateCreators(); addBeanProps(config, beanDesc, deser); SettableBeanProperty prop = constructSettableProperty(config, beanDesc, "cause", am); if (prop != null) { deser.addProperty(prop);
_handleSingleArgumentFactory(config, beanDesc, vchecker, intr, creators, factory, isCreator); throw new IllegalArgumentException("Argument #"+i+" of factory method "+factory+" has no property name annotation; must have when multiple-paramater static method annotated as Creator"); properties[i] = constructCreatorProperty(config, beanDesc, name, i, param, injectableId);
/** * Method that will find if bean has any managed- or back-reference properties, * and if so add them to bean, to be linked during resolution phase. * * @since 1.6 */ protected void addReferenceProperties(DeserializationConfig config, BasicBeanDescription beanDesc, BeanDeserializerBuilder builder) throws JsonMappingException { // and then back references, not necessarily found as regular properties Map<String,AnnotatedMember> refs = beanDesc.findBackReferenceProperties(); if (refs != null) { for (Map.Entry<String, AnnotatedMember> en : refs.entrySet()) { String name = en.getKey(); AnnotatedMember m = en.getValue(); if (m instanceof AnnotatedMethod) { builder.addBackReferenceProperty(name, constructSettableProperty( config, beanDesc, m.getName(), (AnnotatedMethod) m)); } else { builder.addBackReferenceProperty(name, constructSettableProperty( config, beanDesc, m.getName(), (AnnotatedField) m)); } } } }
/** * Method that is to actually build a bean deserializer instance. * All basic sanity checks have been done to know that what we have * may be a valid bean type, and that there are no default simple * deserializers. */ public JsonDeserializer<Object> buildBeanDeserializer(DeserializationConfig config, JavaType type, BasicBeanDescription beanDesc) throws JsonMappingException { BeanDeserializer deser = constructBeanDeserializerInstance(config, type, beanDesc); // First: add constructors addDeserializerCreators(config, beanDesc, deser); // and check that there are enough deser.validateCreators(); // And then setters for deserializing from Json Object addBeanProps(config, beanDesc, deser); return deser; }
if (adapters != null) { CustomSerializerFactory serializerFactory = new CustomSerializerFactory(); BeanDeserializerFactory deserializerFactory = new BeanDeserializerFactory(null); for (XmlJavaTypeAdapter a : adapters.value()) { XmlAdapter xmlAdapter = null; SimpleDeserializers deserializers = new SimpleDeserializers(); deserializers.addDeserializer(a.type(), deserializer); deserializerFactory.withAdditionalDeserializers(deserializers); serializerFactory.addGenericMapping(a.type(), serializer); StdDeserializerProvider deserializerProvider =
type = mapAbstractType(config, type); JsonDeserializer<Object> ad = findDeserializerFromAnnotation(config, beanDesc.getClassInfo(), property); if (ad != null) { return ad; JavaType newType = modifyTypeByAnnotation(config, beanDesc.getClassInfo(), type, null); if (newType.getRawClass() != type.getRawClass()) { type = newType; JsonDeserializer<Object> custom = _findCustomBeanDeserializer(type, config, p, beanDesc, property); if (custom != null) { return custom; return buildThrowableDeserializer(config, type, beanDesc, property); JavaType concreteType = materializeAbstractType(config, beanDesc); if (concreteType != null) { return buildBeanDeserializer(config, concreteType, beanDesc, property); JsonDeserializer<Object> deser = findStdBeanDeserializer(config, p, type, property); if (deser != null) { return deser; if (!isPotentialBeanType(type.getRawClass())) { return null; return buildBeanDeserializer(config, type, beanDesc, property);
if (isIgnorableType(config, beanDesc, type, ignoredTypes)) { SettableBeanProperty prop = constructSettableProperty(config, beanDesc, name, setter); if (prop != null) { builder.addProperty(prop); if (isIgnorableType(config, beanDesc, type, ignoredTypes)) { SettableBeanProperty prop = constructSettableProperty(config, beanDesc, name, field); if (prop != null) { builder.addProperty(prop); builder.setAnySetter(constructAnySetter(config, beanDesc, anySetter)); if (Collection.class.isAssignableFrom(rt) || Map.class.isAssignableFrom(rt)) { if (!ignored.contains(name) && !builder.hasProperty(name)) { builder.addProperty(constructSetterlessProperty(config, beanDesc, name, getter));