public interface PersistentProperty<P extends PersistentProperty<P>>
Modifier and Type | Method and Description |
---|---|
<A extends Annotation> |
findAnnotation(Class<A> annotationType)
Looks up the annotation of the given type on the
PersistentProperty . |
<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.
|
default <T> PersistentPropertyAccessor<T> |
getAccessorForOwner(T owner)
Returns a
PersistentPropertyAccessor for the current property's owning value. |
Class<?> |
getActualType()
Returns the actual type of the property.
|
Association<P> |
getAssociation() |
Class<?> |
getAssociationTargetType()
Return the type the property refers to in case it's an association, i.e.
|
TypeInformation<?> |
getAssociationTargetTypeInformation()
Return the type the property refers to in case it's an association, i.e.
|
Class<?> |
getComponentType()
Returns the component type of the type if it is a
Collection . |
Field |
getField() |
Method |
getGetter()
Returns the getter method to access the property value if available.
|
Class<?> |
getMapValueType()
Returns the type of the values if the property is a
Map . |
String |
getName()
The name of the property
|
PersistentEntity<?,P> |
getOwner()
Returns the
PersistentEntity owning the current PersistentProperty . |
Iterable<? extends TypeInformation<?>> |
getPersistentEntityTypeInformation()
Returns the detected
TypeInformations if the property references a PersistentEntity . |
Iterable<? extends TypeInformation<?>> |
getPersistentEntityTypes()
Deprecated.
since 2.6 for removal in 3.0. Use
getPersistentEntityTypeInformation() instead. |
Class<?> |
getRawType()
Returns the raw type as it's pulled from from the reflected property.
|
default <A extends Annotation> |
getRequiredAnnotation(Class<A> annotationType)
Looks up the annotation of the given type on the
PersistentProperty . |
default Association<P> |
getRequiredAssociation()
Get the
Association of this property. |
default Field |
getRequiredField() |
default Method |
getRequiredGetter() |
default Method |
getRequiredSetter() |
default Method |
getRequiredWither() |
Method |
getSetter()
Returns the setter method to set a property value.
|
String |
getSpelExpression() |
Class<?> |
getType()
The type of the property
|
TypeInformation<?> |
getTypeInformation()
Returns the
TypeInformation of the property. |
Method |
getWither()
Returns the with
Method to set a property value on a new object instance. |
default boolean |
hasActualTypeAnnotation(Class<? extends Annotation> annotationType)
Returns whether the actual type of the property carries the given annotation.
|
boolean |
isAnnotationPresent(Class<? extends Annotation> annotationType)
Returns whether the
PersistentProperty has an annotation of the given type. |
boolean |
isArray()
Returns whether the property is an array.
|
boolean |
isAssociation()
Returns whether the property is an
Association . |
boolean |
isCollectionLike()
Returns whether the property is a
Collection , Iterable or an array. |
boolean |
isEntity()
Returns whether the type of the
PersistentProperty is actually to be regarded as PersistentEntity
in turn. |
boolean |
isIdProperty()
Returns whether the property is a potential identifier property of the owning
PersistentEntity . |
boolean |
isImmutable()
Returns whether the current property is immutable, i.e. if there is no setter or the backing
Field is
final . |
boolean |
isMap()
Returns whether the property is a
Map . |
boolean |
isTransient()
Returns whether the property is transient.
|
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.
|
boolean |
usePropertyAccess()
Returns whether property access shall be used for reading the property value.
|
PersistentEntity<?,P> getOwner()
PersistentEntity
owning the current PersistentProperty
.String getName()
Class<?> getType()
TypeInformation<?> getTypeInformation()
TypeInformation
of the property.@Deprecated Iterable<? extends TypeInformation<?>> getPersistentEntityTypes()
getPersistentEntityTypeInformation()
instead.TypeInformation
if the property references a PersistentEntity
. Will return
null in case it refers to a simple type. Will return Collection
's component type or the
Map
's value type transparently.Iterable<? extends TypeInformation<?>> getPersistentEntityTypeInformation()
TypeInformations
if the property references a PersistentEntity
.
Will return an empty Iterable
in case it refers to a simple type. Will return the Collection
's
component types or the Map
's value type transparently.@Nullable Method getGetter()
default Method getRequiredGetter()
@Nullable Method getSetter()
default Method getRequiredSetter()
@Nullable Method getWither()
Method
to set a property value on a new object instance. Might return null in
case there is no with available.
With methods
are property-bound instance methods
that accept a single argument of the
property type creating a new object instance.
class Person { final String id; final String name; // … Person withName(String name) { return new Person(this.id, name); } }
Method
to set a property value on a new object instance if available, otherwise
null.default Method getRequiredWither()
default Field getRequiredField()
@Nullable Association<P> getAssociation()
Association
.default Association<P> getRequiredAssociation()
Association
of this property.IllegalStateException
- if not involved in an Association
.boolean isEntity()
PersistentProperty
is actually to be regarded as PersistentEntity
in turn.PersistentEntity
.boolean isIdProperty()
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.boolean isVersionProperty()
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.boolean isCollectionLike()
Collection
, Iterable
or an array.boolean isMap()
Map
.boolean isArray()
boolean isTransient()
boolean isWritable()
boolean isImmutable()
Field
is
final
.Modifier.isFinal(int)
boolean isAssociation()
Association
.@Nullable Class<?> getComponentType()
Collection
. Will return the type of the key if
the property is a Map
.Collection
nor
Map
.Class<?> getRawType()
@Nullable Class<?> getMapValueType()
Map
.Map
Class<?> getActualType()
@Nullable <A extends Annotation> A findAnnotation(Class<A> annotationType)
PersistentProperty
. Will inspect accessors and the
potentially backing field and traverse accessor methods to potentially available super types.annotationType
- the annotation to look up, must not be null.AnnotationUtils.findAnnotation(Method, Class)
default <A extends Annotation> A getRequiredAnnotation(Class<A> annotationType) throws IllegalStateException
PersistentProperty
. Will inspect accessors and the
potentially backing field and traverse accessor methods to potentially available super types.annotationType
- the annotation to look up, must not be null.IllegalStateException
- if the required annotationType
is not found.@Nullable <A extends Annotation> A findPropertyOrOwnerAnnotation(Class<A> annotationType)
annotationType
- must not be null.boolean isAnnotationPresent(Class<? extends Annotation> annotationType)
PersistentProperty
has an annotation of the given type.annotationType
- the annotation to lookup, must not be null.PersistentProperty
has an annotation of the given type.boolean usePropertyAccess()
default boolean hasActualTypeAnnotation(Class<? extends Annotation> annotationType)
annotationType
- must not be null.getActualType()
@Nullable Class<?> getAssociationTargetType()
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 isAssociation()
.isAssociation()
returns
true.@Nullable TypeInformation<?> getAssociationTargetTypeInformation()
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 isAssociation()
.isAssociation()
returns
true.default <T> PersistentPropertyAccessor<T> getAccessorForOwner(T owner)
PersistentPropertyAccessor
for the current property's owning value.owner
- must not be null.Copyright © 2011–2021 Pivotal Software, Inc.. All rights reserved.