public abstract class AnnotationBasedPersistentProperty<P extends PersistentProperty<P>> extends AbstractPersistentProperty<P>
PersistentProperty
that takes annotations at a property into account.Constructor and Description |
---|
AnnotationBasedPersistentProperty(Property property,
PersistentEntity<?,P> owner,
SimpleTypeHolder simpleTypeHolder)
Creates a new
AnnotationBasedPersistentProperty . |
Modifier and Type | Method and Description |
---|---|
<A extends Annotation> |
findAnnotation(Class<A> annotationType)
Returns the annotation found for the current
AnnotationBasedPersistentProperty . |
<A extends Annotation> |
findPropertyOrOwnerAnnotation(Class<A> annotationType)
Looks up the annotation of the given type on the property and the owning type if no annotation can be found on it.
|
TypeInformation<?> |
getAssociationTargetTypeInformation()
Return the type the property refers to in case it's an association, i.e.
|
String |
getSpelExpression()
|
boolean |
isAnnotationPresent(Class<? extends Annotation> annotationType)
Returns whether the property carries the an annotation of the given type.
|
boolean |
isAssociation()
Considers the property an
Association if it is annotated with Reference . |
boolean |
isIdProperty()
Returns whether the property is a potential identifier property of the owning
PersistentEntity . |
boolean |
isTransient()
|
boolean |
isVersionProperty()
Returns whether the current property is a potential version property of the owning
PersistentEntity . |
boolean |
isWritable()
Returns whether the current property is writable, i.e. if the value held for it shall be written to the data store.
|
String |
toString() |
boolean |
usePropertyAccess()
Returns whether property access shall be used for reading the property value.
|
createAssociation, equals, getActualType, getActualTypeInformation, getAssociation, getAssociationTargetType, getComponentType, getField, getGetter, getMapValueType, getName, getOwner, getPersistentEntityTypeInformation, getPersistentEntityTypes, getProperty, getRawType, getSetter, getType, getTypeInformation, getWither, hashCode, isArray, isCollectionLike, isEntity, isImmutable, isMap
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
getAccessorForOwner, getRequiredAnnotation, getRequiredAssociation, getRequiredField, getRequiredGetter, getRequiredSetter, getRequiredWither, hasActualTypeAnnotation
public AnnotationBasedPersistentProperty(Property property, PersistentEntity<?,P> owner, SimpleTypeHolder simpleTypeHolder)
AnnotationBasedPersistentProperty
.property
- must not be null.owner
- must not be null.@Nullable public String getSpelExpression()
Value
annotation at the property and returns the String
value of
it.getSpelExpression
in interface PersistentProperty<P extends PersistentProperty<P>>
getSpelExpression
in class AbstractPersistentProperty<P extends PersistentProperty<P>>
AbstractPersistentProperty.getSpelExpression()
public boolean isTransient()
isTransient
in interface PersistentProperty<P extends PersistentProperty<P>>
isTransient
in class AbstractPersistentProperty<P extends PersistentProperty<P>>
PersistentProperty.isTransient()
public boolean isIdProperty()
PersistentProperty
PersistentEntity
.
This method is mainly used by PersistentEntity
implementation to discover id property candidates on
PersistentEntity
creation you should rather call PersistentEntity.isIdProperty(PersistentProperty)
to determine whether the current property is the id property of that PersistentEntity
under consideration.public boolean isVersionProperty()
PersistentProperty
PersistentEntity
. This method is mainly used by PersistentEntity
implementation to discover version
property candidates on PersistentEntity
creation you should rather call
PersistentEntity.isVersionProperty(PersistentProperty)
to determine whether the current property is the
version property of that PersistentEntity
under consideration.public boolean isAssociation()
Association
if it is annotated with Reference
.isAssociation
in interface PersistentProperty<P extends PersistentProperty<P>>
isAssociation
in class AbstractPersistentProperty<P extends PersistentProperty<P>>
public boolean isWritable()
PersistentProperty
isWritable
in interface PersistentProperty<P extends PersistentProperty<P>>
isWritable
in class AbstractPersistentProperty<P extends PersistentProperty<P>>
@Nullable public <A extends Annotation> A findAnnotation(Class<A> annotationType)
AnnotationBasedPersistentProperty
. Will prefer getters or
setters annotations over ones found at the backing field as the former can be used to reconfigure the metadata in
subclasses.annotationType
- must not be null.AnnotationUtils.findAnnotation(Method, Class)
@Nullable public <A extends Annotation> A findPropertyOrOwnerAnnotation(Class<A> annotationType)
PersistentProperty
annotationType
- must not be null.public boolean isAnnotationPresent(Class<? extends Annotation> annotationType)
annotationType
- the annotation type to look up.public boolean usePropertyAccess()
PersistentProperty
usePropertyAccess
in interface PersistentProperty<P extends PersistentProperty<P>>
usePropertyAccess
in class AbstractPersistentProperty<P extends PersistentProperty<P>>
@Nullable public TypeInformation<?> getAssociationTargetTypeInformation()
PersistentProperty
PersistentProperty.isAssociation()
returns
true. That means, that implementations must return a non-null value from this method
in that case. We also recommend to return null for non-associations right away to establish symmetry
between this method and PersistentProperty.isAssociation()
.getAssociationTargetTypeInformation
in interface PersistentProperty<P extends PersistentProperty<P>>
getAssociationTargetTypeInformation
in class AbstractPersistentProperty<P extends PersistentProperty<P>>
PersistentProperty.isAssociation()
returns
true.public String toString()
toString
in class AbstractPersistentProperty<P extends PersistentProperty<P>>
Copyright © 2011–2022 Pivotal Software, Inc.. All rights reserved.