public interface PersistentEntity<T,P extends PersistentProperty<P>>
Type | Property and Description |
---|---|
boolean |
hasId
Returns whether the
PersistentEntity has an id property. |
boolean |
hasVersion
Returns whether the
PersistentEntity has a version property. |
Modifier and Type | Method and Description |
---|---|
void |
doWithAssociations(AssociationHandler<P> handler)
|
void |
doWithAssociations(SimpleAssociationHandler handler) |
void |
doWithProperties(PropertyHandler<P> handler)
|
void |
doWithProperties(SimplePropertyHandler handler) |
<A extends Annotation> |
findAnnotation(Class<A> annotationType)
Looks up the annotation of the given type on the
PersistentEntity . |
Stream<Association<P>> |
getAssociations() |
IdentifierAccessor |
getIdentifierAccessor(Object bean)
Returns the
IdentifierAccessor for the given bean. |
Optional<P> |
getIdProperty()
Returns the id property of the
PersistentEntity . |
String |
getName()
The entity name including any package prefix.
|
Optional<PreferredConstructor<T,P>> |
getPersistenceConstructor()
Returns the
PreferredConstructor to be used to instantiate objects of this PersistentEntity . |
Stream<P> |
getPersistentProperties() |
Optional<P> |
getPersistentProperty(Class<? extends Annotation> annotationType)
Returns the property equipped with an annotation of the given type.
|
Optional<P> |
getPersistentProperty(String name)
Obtains a
PersistentProperty instance by name. |
PersistentPropertyAccessor |
getPropertyAccessor(Object bean)
Returns a
PersistentPropertyAccessor to access property values of the given bean. |
default P |
getRequiredIdProperty() |
default P |
getRequiredPersistentProperty(String name)
Returns the
PersistentProperty with the given name. |
Class<T> |
getType()
Returns the resolved Java type of this entity.
|
Alias |
getTypeAlias()
Returns the alias to be used when storing type information.
|
TypeInformation<T> |
getTypeInformation()
Returns the
TypeInformation backing this PersistentEntity . |
Optional<P> |
getVersionProperty()
Returns the version property of the
PersistentEntity . |
boolean |
hasIdProperty()
Returns whether the
PersistentEntity has an id property. |
boolean |
hasVersionProperty()
Returns whether the
PersistentEntity has a version property. |
boolean |
isConstructorArgument(PersistentProperty<?> property)
Returns whether the given
PersistentProperty is referred to by a constructor argument of the
PersistentEntity . |
boolean |
isIdProperty(PersistentProperty<?> property)
Returns whether the given
PersistentProperty is the id property of the entity. |
boolean |
isVersionProperty(PersistentProperty<?> property)
Returns whether the given
PersistentProperty is the version property of the entity. |
boolean hasIdProperty
PersistentEntity
has an id property. If this call returns true,
getIdProperty()
will return a non-null value.boolean hasVersionProperty
PersistentEntity
has a version property. If this call returns true,
getVersionProperty()
will return a non-null value.String getName()
Optional<PreferredConstructor<T,P>> getPersistenceConstructor()
PreferredConstructor
to be used to instantiate objects of this PersistentEntity
.Optional
in case no suitable constructor for automatic construction can be found. This
usually indicates that the instantiation of the object of that persistent entity is done through either a
customer EntityInstantiator
or handled by custom conversion mechanisms entirely.boolean isConstructorArgument(PersistentProperty<?> property)
PersistentProperty
is referred to by a constructor argument of the
PersistentEntity
.property
- PersistentProperty
is referred to by a constructor argument or false
if not or null.boolean isIdProperty(PersistentProperty<?> property)
PersistentProperty
is the id property of the entity.property
- boolean isVersionProperty(PersistentProperty<?> property)
PersistentProperty
is the version property of the entity.property
- Optional<P> getIdProperty()
PersistentEntity
. Can be null in case this is an entity
completely handled by a custom conversion.PersistentEntity
.default P getRequiredIdProperty()
Optional<P> getVersionProperty()
PersistentEntity
. Can be null in case no version property is
available on the entity.PersistentEntity
.Optional<P> getPersistentProperty(String name)
PersistentProperty
instance by name.name
- The name of the propertyPersistentProperty
or Optional#empty() if it doesn't exist.default P getRequiredPersistentProperty(String name)
PersistentProperty
with the given name.name
- the name of the property, must not be null or empty.PersistentProperty
with the given name.IllegalArgumentException
- in case no property with the given name exists.Optional<P> getPersistentProperty(Class<? extends Annotation> annotationType)
annotationType
- must not be null.boolean hasIdProperty()
PersistentEntity
has an id property. If this call returns true,
getIdProperty()
will return a non-null value.boolean hasVersionProperty()
PersistentEntity
has a version property. If this call returns true,
getVersionProperty()
will return a non-null value.Class<T> getType()
Alias getTypeAlias()
TypeInformation<T> getTypeInformation()
TypeInformation
backing this PersistentEntity
.void doWithProperties(PropertyHandler<P> handler)
handler
- must not be null.void doWithProperties(SimplePropertyHandler handler)
void doWithAssociations(AssociationHandler<P> handler)
handler
- must not be null.void doWithAssociations(SimpleAssociationHandler handler)
Stream<Association<P>> getAssociations()
<A extends Annotation> Optional<A> findAnnotation(Class<A> annotationType)
PersistentEntity
.annotationType
- must not be null.PersistentPropertyAccessor getPropertyAccessor(Object bean)
PersistentPropertyAccessor
to access property values of the given bean.bean
- must not be null.IdentifierAccessor getIdentifierAccessor(Object bean)
IdentifierAccessor
for the given bean.bean
- must not be null.Copyright © 2011-2016–2017 Pivotal Software, Inc.. All rights reserved.