|
|
|
@ -447,10 +447,8 @@ public class BasicPersistentEntity<T, P extends PersistentProperty<P>> implement |
|
|
|
public PersistentPropertyAccessor getPropertyAccessor(Object bean) { |
|
|
|
public PersistentPropertyAccessor getPropertyAccessor(Object bean) { |
|
|
|
|
|
|
|
|
|
|
|
Assert.notNull(bean, "Target bean must not be null!"); |
|
|
|
Assert.notNull(bean, "Target bean must not be null!"); |
|
|
|
|
|
|
|
Assert.isTrue(getType().isInstance(bean), |
|
|
|
if (!getType().isInstance(bean)) { // prevent capturing lambda
|
|
|
|
() -> String.format(TYPE_MISMATCH, bean.getClass().getName(), getType().getName())); |
|
|
|
throw new IllegalArgumentException(String.format(TYPE_MISMATCH, bean.getClass().getName(), getType().getName())); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return propertyAccessorFactory.getPropertyAccessor(this, bean); |
|
|
|
return propertyAccessorFactory.getPropertyAccessor(this, bean); |
|
|
|
} |
|
|
|
} |
|
|
|
@ -463,10 +461,8 @@ public class BasicPersistentEntity<T, P extends PersistentProperty<P>> implement |
|
|
|
public IdentifierAccessor getIdentifierAccessor(Object bean) { |
|
|
|
public IdentifierAccessor getIdentifierAccessor(Object bean) { |
|
|
|
|
|
|
|
|
|
|
|
Assert.notNull(bean, "Target bean must not be null!"); |
|
|
|
Assert.notNull(bean, "Target bean must not be null!"); |
|
|
|
|
|
|
|
Assert.isTrue(getType().isInstance(bean), |
|
|
|
if (!getType().isInstance(bean)) { // prevent capturing lambda
|
|
|
|
() -> String.format(TYPE_MISMATCH, bean.getClass().getName(), getType().getName())); |
|
|
|
throw new IllegalArgumentException(String.format(TYPE_MISMATCH, bean.getClass().getName(), getType().getName())); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return hasIdProperty() ? new IdPropertyIdentifierAccessor(this, bean) : new AbsentIdentifierAccessor(bean); |
|
|
|
return hasIdProperty() ? new IdPropertyIdentifierAccessor(this, bean) : new AbsentIdentifierAccessor(bean); |
|
|
|
} |
|
|
|
} |
|
|
|
|