|
Spring Data Commons | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.springframework.data.mapping.model.BasicPersistentEntity<T,P>
public class BasicPersistentEntity<T,P extends PersistentProperty<P>>
Simple value object to capture information of PersistentEntity
s.
Constructor Summary | |
---|---|
BasicPersistentEntity(TypeInformation<T> information)
Creates a new BasicPersistentEntity from the given TypeInformation . |
|
BasicPersistentEntity(TypeInformation<T> information,
Comparator<P> comparator)
Creates a new BasicPersistentEntity for the given TypeInformation and Comparator . |
Method Summary | |
---|---|
void |
addAssociation(Association<P> association)
Adds an Association to the entity. |
void |
addPersistentProperty(P property)
Adds a PersistentProperty to the entity. |
void |
doWithAssociations(AssociationHandler<P> handler)
Applies the given AssociationHandler to all Association contained in this PersistentEntity . |
void |
doWithProperties(PropertyHandler<P> handler)
Applies the given PropertyHandler to all PersistentProperty s contained in this
PersistentEntity . |
P |
getIdProperty()
Returns the id property of the PersistentEntity . |
String |
getName()
The entity name including any package prefix |
P |
getPersistentProperty(String name)
Obtains a PersistentProperty instance by name. |
PreferredConstructor<T> |
getPreferredConstructor()
Returns the PreferredConstructor to be used to instantiate objects of this PersistentEntity . |
Class<T> |
getType()
Returns the resolved Java type of this entity. |
TypeInformation<T> |
getTypeInformation()
Returns the TypeInformation backing this PersistentEntity . |
void |
setIdProperty(P property)
Sets the id property for the entity. |
void |
verify()
Callback method to trigger validation of the PersistentEntity . |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public BasicPersistentEntity(TypeInformation<T> information)
BasicPersistentEntity
from the given TypeInformation
.
information
- must not be null.public BasicPersistentEntity(TypeInformation<T> information, Comparator<P> comparator)
BasicPersistentEntity
for the given TypeInformation
and Comparator
. The given
Comparator
will be used to define the order of the PersistentProperty
instances added to the
entity.
information
- must not be nullcomparator
- Method Detail |
---|
public PreferredConstructor<T> getPreferredConstructor()
PersistentEntity
PreferredConstructor
to be used to instantiate objects of this PersistentEntity
.
getPreferredConstructor
in interface PersistentEntity<T,P extends PersistentProperty<P>>
public String getName()
PersistentEntity
getName
in interface PersistentEntity<T,P extends PersistentProperty<P>>
public P getIdProperty()
PersistentEntity
PersistentEntity
. Must never return null as a
PersistentEntity
instance must not be created if there is no id property.
getIdProperty
in interface PersistentEntity<T,P extends PersistentProperty<P>>
PersistentEntity
.public void setIdProperty(P property)
MutablePersistentEntity
setIdProperty
in interface MutablePersistentEntity<T,P extends PersistentProperty<P>>
public void addPersistentProperty(P property)
MutablePersistentEntity
PersistentProperty
to the entity.
addPersistentProperty
in interface MutablePersistentEntity<T,P extends PersistentProperty<P>>
public void addAssociation(Association<P> association)
MutablePersistentEntity
Association
to the entity.
addAssociation
in interface MutablePersistentEntity<T,P extends PersistentProperty<P>>
public P getPersistentProperty(String name)
PersistentEntity
getPersistentProperty
in interface PersistentEntity<T,P extends PersistentProperty<P>>
name
- The name of the property
PersistentProperty
or null if it doesn't existpublic Class<T> getType()
PersistentEntity
getType
in interface PersistentEntity<T,P extends PersistentProperty<P>>
public TypeInformation<T> getTypeInformation()
PersistentEntity
TypeInformation
backing this PersistentEntity
.
getTypeInformation
in interface PersistentEntity<T,P extends PersistentProperty<P>>
public void doWithProperties(PropertyHandler<P> handler)
PersistentEntity
PropertyHandler
to all PersistentProperty
s contained in this
PersistentEntity
.
doWithProperties
in interface PersistentEntity<T,P extends PersistentProperty<P>>
handler
- must not be null.public void doWithAssociations(AssociationHandler<P> handler)
PersistentEntity
AssociationHandler
to all Association
contained in this PersistentEntity
.
doWithAssociations
in interface PersistentEntity<T,P extends PersistentProperty<P>>
handler
- must not be null.public void verify()
MutablePersistentEntity
PersistentEntity
. As
MutablePersistentEntity
is not immutable there might be some
verification steps necessary after the object has reached is final state.
verify
in interface MutablePersistentEntity<T,P extends PersistentProperty<P>>
|
Spring Data Commons | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |