Use Property#getPropertyAccessStrategy which internally delegates to BuiltInPropertyAccessStrategies to handle enhanced cases

This commit is contained in:
Christian Beikov 2021-05-05 12:00:43 +02:00
parent 8e26756cce
commit 71f666f0b6
2 changed files with 4 additions and 17 deletions

View File

@ -83,16 +83,10 @@ public class StandardPojoEmbeddableRepresentationStrategy extends AbstractEmbedd
@Override
protected PropertyAccess buildPropertyAccess(Property bootAttributeDescriptor) {
PropertyAccessStrategy strategy = null;
final String propertyAccessorName = bootAttributeDescriptor.getPropertyAccessorName();
final BuiltInPropertyAccessStrategies namedStrategy = BuiltInPropertyAccessStrategies.interpret(
propertyAccessorName );
if ( namedStrategy != null ) {
strategy = namedStrategy.getStrategy();
}
PropertyAccessStrategy strategy = bootAttributeDescriptor.getPropertyAccessStrategy( getEmbeddableJavaTypeDescriptor().getJavaTypeClass() );
if ( strategy == null ) {
final String propertyAccessorName = bootAttributeDescriptor.getPropertyAccessorName();
if ( StringHelper.isNotEmpty( propertyAccessorName ) ) {
// handle explicitly specified attribute accessor

View File

@ -320,17 +320,10 @@ public class StandardPojoEntityRepresentationStrategy implements EntityRepresent
}
private PropertyAccess makePropertyAccess(Property bootAttributeDescriptor) {
PropertyAccessStrategy strategy = null;
final String propertyAccessorName = bootAttributeDescriptor.getPropertyAccessorName();
final BuiltInPropertyAccessStrategies namedStrategy = BuiltInPropertyAccessStrategies.interpret(
propertyAccessorName );
if ( namedStrategy != null ) {
strategy = namedStrategy.getStrategy();
}
PropertyAccessStrategy strategy = bootAttributeDescriptor.getPropertyAccessStrategy( mappedJtd.getJavaTypeClass() );
if ( strategy == null ) {
final String propertyAccessorName = bootAttributeDescriptor.getPropertyAccessorName();
if ( StringHelper.isNotEmpty( propertyAccessorName ) ) {
// handle explicitly specified attribute accessor
strategy = strategySelector.resolveStrategy( PropertyAccessStrategy.class, propertyAccessorName );