public abstract class AbstractPersistentProperty<P extends PersistentProperty<P>> extends Object implements PersistentProperty<P>
PersistentProperty
.Constructor and Description |
---|
AbstractPersistentProperty(Property property,
PersistentEntity<?,P> owner,
SimpleTypeHolder simpleTypeHolder) |
Modifier and Type | Method and Description |
---|---|
protected abstract Association<P> |
createAssociation() |
boolean |
equals(Object obj) |
Class<?> |
getActualType()
Returns the actual type of the property.
|
protected TypeInformation<?> |
getActualTypeInformation() |
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()
Returns the
TypeInformation if the property references a PersistentEntity . |
protected Property |
getProperty() |
Class<?> |
getRawType()
Returns the raw type as it's pulled from from the reflected property.
|
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. |
int |
hashCode() |
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 |
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 |
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.
|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
findAnnotation, findPropertyOrOwnerAnnotation, getAccessorForOwner, getRequiredAnnotation, getRequiredAssociation, getRequiredField, getRequiredGetter, getRequiredSetter, getRequiredWither, hasActualTypeAnnotation, isAnnotationPresent, isIdProperty, isVersionProperty
public AbstractPersistentProperty(Property property, PersistentEntity<?,P> owner, SimpleTypeHolder simpleTypeHolder)
protected abstract Association<P> createAssociation()
public PersistentEntity<?,P> getOwner()
PersistentProperty
PersistentEntity
owning the current PersistentProperty
.getOwner
in interface PersistentProperty<P extends PersistentProperty<P>>
public String getName()
PersistentProperty
getName
in interface PersistentProperty<P extends PersistentProperty<P>>
public Class<?> getType()
PersistentProperty
getType
in interface PersistentProperty<P extends PersistentProperty<P>>
public Class<?> getRawType()
PersistentProperty
getRawType
in interface PersistentProperty<P extends PersistentProperty<P>>
public TypeInformation<?> getTypeInformation()
PersistentProperty
TypeInformation
of the property.getTypeInformation
in interface PersistentProperty<P extends PersistentProperty<P>>
public Iterable<? extends TypeInformation<?>> getPersistentEntityTypes()
PersistentProperty
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.getPersistentEntityTypes
in interface PersistentProperty<P extends PersistentProperty<P>>
public Iterable<? extends TypeInformation<?>> getPersistentEntityTypeInformation()
PersistentProperty
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.getPersistentEntityTypeInformation
in interface PersistentProperty<P extends PersistentProperty<P>>
@Nullable public Method getGetter()
PersistentProperty
getGetter
in interface PersistentProperty<P extends PersistentProperty<P>>
@Nullable public Method getSetter()
PersistentProperty
getSetter
in interface PersistentProperty<P extends PersistentProperty<P>>
@Nullable public Method getWither()
PersistentProperty
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); } }
getWither
in interface PersistentProperty<P extends PersistentProperty<P>>
Method
to set a property value on a new object instance if available, otherwise
null.@Nullable public Field getField()
getField
in interface PersistentProperty<P extends PersistentProperty<P>>
@Nullable public String getSpelExpression()
getSpelExpression
in interface PersistentProperty<P extends PersistentProperty<P>>
public boolean isTransient()
PersistentProperty
isTransient
in interface PersistentProperty<P extends PersistentProperty<P>>
public boolean isWritable()
PersistentProperty
isWritable
in interface PersistentProperty<P extends PersistentProperty<P>>
public boolean isImmutable()
PersistentProperty
Field
is
final
.isImmutable
in interface PersistentProperty<P extends PersistentProperty<P>>
Modifier.isFinal(int)
public boolean isAssociation()
PersistentProperty
Association
.isAssociation
in interface PersistentProperty<P extends PersistentProperty<P>>
@Nullable public Association<P> getAssociation()
getAssociation
in interface PersistentProperty<P extends PersistentProperty<P>>
Association
.@Nullable public Class<?> getAssociationTargetType()
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()
.getAssociationTargetType
in interface PersistentProperty<P extends PersistentProperty<P>>
PersistentProperty.isAssociation()
returns
true.@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>>
PersistentProperty.isAssociation()
returns
true.public boolean isCollectionLike()
PersistentProperty
Collection
, Iterable
or an array.isCollectionLike
in interface PersistentProperty<P extends PersistentProperty<P>>
public boolean isMap()
PersistentProperty
Map
.isMap
in interface PersistentProperty<P extends PersistentProperty<P>>
public boolean isArray()
PersistentProperty
isArray
in interface PersistentProperty<P extends PersistentProperty<P>>
public boolean isEntity()
PersistentProperty
PersistentProperty
is actually to be regarded as PersistentEntity
in turn.isEntity
in interface PersistentProperty<P extends PersistentProperty<P>>
PersistentEntity
.@Nullable public Class<?> getComponentType()
PersistentProperty
Collection
. Will return the type of the key if
the property is a Map
.getComponentType
in interface PersistentProperty<P extends PersistentProperty<P>>
Collection
nor
Map
.@Nullable public Class<?> getMapValueType()
PersistentProperty
Map
.getMapValueType
in interface PersistentProperty<P extends PersistentProperty<P>>
Map
public Class<?> getActualType()
PersistentProperty
getActualType
in interface PersistentProperty<P extends PersistentProperty<P>>
public boolean usePropertyAccess()
PersistentProperty
usePropertyAccess
in interface PersistentProperty<P extends PersistentProperty<P>>
protected Property getProperty()
protected TypeInformation<?> getActualTypeInformation()
Copyright © 2011–2022 Pivotal Software, Inc.. All rights reserved.