|
24 | 24 | import java.util.List; |
25 | 25 | import java.util.Map; |
26 | 26 | import java.util.Map.Entry; |
27 | | -import java.util.Objects; |
28 | 27 | import java.util.Optional; |
29 | 28 |
|
30 | 29 | import org.slf4j.Logger; |
|
83 | 82 | import com.fasterxml.jackson.databind.deser.std.StdDeserializer; |
84 | 83 | import com.fasterxml.jackson.databind.deser.std.StdScalarDeserializer; |
85 | 84 | import com.fasterxml.jackson.databind.deser.std.StdValueInstantiator; |
86 | | -import com.fasterxml.jackson.databind.introspect.AnnotatedField; |
87 | | -import com.fasterxml.jackson.databind.introspect.BeanPropertyDefinition; |
88 | 85 | import com.fasterxml.jackson.databind.jsontype.TypeDeserializer; |
89 | 86 | import com.fasterxml.jackson.databind.jsontype.TypeSerializer; |
90 | 87 | import com.fasterxml.jackson.databind.module.SimpleModule; |
@@ -445,21 +442,12 @@ public BeanDeserializerBuilder updateBuilder(DeserializationConfig config, BeanD |
445 | 442 |
|
446 | 443 | entities.getPersistentEntity(beanDesc.getBeanClass()).ifPresent(entity -> { |
447 | 444 |
|
| 445 | + MappedProperties mapped = MappedProperties.forDescription(entity, beanDesc); |
| 446 | + |
448 | 447 | while (properties.hasNext()) { |
449 | 448 |
|
450 | 449 | SettableBeanProperty property = properties.next(); |
451 | | - // To find the PersistentProperty name in case there is a @JsonProperty annotation |
452 | | - // on the field. Both BeanPropertyDefinition#getName() and BeanPropertyDefinition#getInternalName() |
453 | | - // don't return the actual name of the field, so we look up the AnnotatedField itself to retrieve |
454 | | - // the real name from, so it can be used for PersistentProperty lookup |
455 | | - String persistentPropertyName = beanDesc.findProperties().stream() |
456 | | - .filter(propertyDefinition -> property.getName().equals(propertyDefinition.getName())) |
457 | | - .map(BeanPropertyDefinition::getField).filter(Objects::nonNull).map(AnnotatedField::getName).findFirst() |
458 | | - // Fall back to the JSON name in case we can't find a BeanPropertyDefinition, |
459 | | - // so things can be mapped by convention in case they are immutable objects and are |
460 | | - // using constructor injection |
461 | | - .orElse(property.getName()); |
462 | | - PersistentProperty<?> persistentProperty = entity.getPersistentProperty(persistentPropertyName); |
| 450 | + PersistentProperty<?> persistentProperty = mapped.getPersistentProperty(property.getName()); |
463 | 451 |
|
464 | 452 | if (persistentProperty == null) { |
465 | 453 | continue; |
|
0 commit comments