Class RuntimePersistentEntity<T>
java.lang.Object
io.micronaut.data.model.AbstractPersistentEntity
io.micronaut.data.model.runtime.RuntimePersistentEntity<T>
- Type Parameters:
T- The type
- All Implemented Interfaces:
io.micronaut.core.annotation.AnnotationMetadataProvider, io.micronaut.core.annotation.AnnotationSource, io.micronaut.core.naming.Named, PersistentElement, PersistentEntity
Runtime implementation of
PersistentEntity that uses pre-computed Introspected bean data and is completely stateless.- Since:
- 1.0
- Author:
- graemerocher
-
Field Summary
Fields inherited from interface io.micronaut.core.annotation.AnnotationSource
EMPTY -
Constructor Summary
ConstructorsConstructorDescriptionRuntimePersistentEntity(io.micronaut.core.beans.BeanIntrospection<T> introspection) Default constructor.RuntimePersistentEntity(io.micronaut.core.beans.BeanIntrospection<T> introspection, Collection<io.micronaut.core.beans.BeanProperty<T, Object>> beanProperties) Default constructor.RuntimePersistentEntity(Class<T> type) Default constructor. -
Method Summary
Modifier and TypeMethodDescriptionbooleanDoes cascade the persist to any of the associations.booleanDoes cascade the update to any of the associations.A list of the associations for this entity.The composite id.protected RuntimePersistentEntity<T> Obtain an entity for the given type.Returns the identity of the instance.@Nullable RuntimePersistentProperty<T> getIdentityByName(String name) Obtains an identity PersistentProperty instance by name.Returns all identity properties.io.micronaut.core.beans.BeanIntrospection<T> getName()The entity name including any package prefix.@Nullable PersistentEntityReturns the parent entity of this entity.A list of properties to be persisted.A list of property names that a persistent.@Nullable RuntimePersistentProperty<T> getPropertyByName(String name) Gets a PersistentProperty instance by name.@Nullable RuntimePersistentProperty<T> Gets a PersistentProperty instance by name ignoring the case.An alternative togetIdentityProperties()but that returnsRuntimePersistentProperty.Returns the version property.booleanbooleanHas composite identity.booleanHas identity.booleanDoes the entity have post-load event listeners.booleanDoes the entity have post-persist event listeners.booleanDoes the entity have post-remove event listeners.booleanDoes the entity have post-update event listeners.booleanDoes the entity have pre-persist event listeners.booleanDoes the entity have pre-remove event listeners.booleanDoes the entity have pre-update event listeners.booleanIs the entity versioned for optimistic locking.booleanisOwningEntity(PersistentEntity owner) Returns whether the specified entity asserts ownership over this entity.protected voidLog error message.protected AttributeConverter<Object, Object> resolveConverter(Class<?> converterClass) Resolves a converter instance.toString()Methods inherited from class AbstractPersistentEntity
equals, findNamingStrategy, getAnnotationMetadata, getNamingStrategy, getPersistedName, hashCodeMethods inherited from interface io.micronaut.core.annotation.AnnotationMetadataProvider
findAnnotation, findAnnotation, findDeclaredAnnotation, findDeclaredAnnotation, getTargetAnnotationMetadata, isAnnotationPresent, isDeclaredAnnotationPresent, synthesize, synthesizeAll, synthesizeAnnotationsByType, synthesizeDeclared, synthesizeDeclared, synthesizeDeclaredAnnotationsByTypeMethods inherited from interface io.micronaut.core.annotation.AnnotationSource
getAnnotation, getAnnotation, getDeclaredAnnotation, getDeclaredAnnotation, isAnnotationPresent, isDeclaredAnnotationPresent, synthesize, synthesizeDeclaredMethods inherited from interface PersistentEntity
getDecapitalizedName, getEmbedded, getPath, getPropertyByPath, getPropertyPath, getPropertyPath, getRootEntity, getSimpleName, isEmbeddable, isRoot
-
Constructor Details
-
RuntimePersistentEntity
-
RuntimePersistentEntity
Default constructor.- Parameters:
introspection- The introspection
-
RuntimePersistentEntity
public RuntimePersistentEntity(io.micronaut.core.beans.BeanIntrospection<T> introspection, Collection<io.micronaut.core.beans.BeanProperty<T, Object>> beanProperties) Default constructor.- Parameters:
introspection- The introspectionbeanProperties- The bean properties
-
-
Method Details
-
logDebug
Description copied from class:AbstractPersistentEntityLog error message.- Overrides:
logDebugin classAbstractPersistentEntity- Parameters:
message- The messagee- The exception
-
resolveConverter
Resolves a converter instance.- Parameters:
converterClass- The converter class- Returns:
- converter instance
-
cascadesPersist
public boolean cascadesPersist()Does cascade the persist to any of the associations.- Returns:
- True if it does
-
cascadesUpdate
public boolean cascadesUpdate()Does cascade the update to any of the associations.- Returns:
- True if it does
-
hasPrePersistEventListeners
public boolean hasPrePersistEventListeners()Does the entity have pre-persist event listeners.- Returns:
- True if it does
-
hasPreRemoveEventListeners
public boolean hasPreRemoveEventListeners()Does the entity have pre-remove event listeners.- Returns:
- True if it does
-
hasPreUpdateEventListeners
public boolean hasPreUpdateEventListeners()Does the entity have pre-update event listeners.- Returns:
- True if it does
-
hasPostPersistEventListeners
public boolean hasPostPersistEventListeners()Does the entity have post-persist event listeners.- Returns:
- True if it does
-
hasPostUpdateEventListeners
public boolean hasPostUpdateEventListeners()Does the entity have post-update event listeners.- Returns:
- True if it does
-
hasPostRemoveEventListeners
public boolean hasPostRemoveEventListeners()Does the entity have post-remove event listeners.- Returns:
- True if it does
-
hasPostLoadEventListeners
public boolean hasPostLoadEventListeners()Does the entity have post-load event listeners.- Returns:
- True if it does
-
toString
-
getAliasName
- Specified by:
getAliasNamein interfacePersistentEntity- Overrides:
getAliasNamein classAbstractPersistentEntity- Returns:
- A name to use when referring to this element via an alias.
-
getIntrospection
- Returns:
- The underlying introspection.
-
getName
Description copied from interface:PersistentEntityThe entity name including any package prefix.- Returns:
- The entity name
-
hasCompositeIdentity
public boolean hasCompositeIdentity()Description copied from interface:PersistentEntityHas composite identity.- Returns:
- The true if composite identity present
-
hasIdentity
public boolean hasIdentity()Description copied from interface:PersistentEntityHas identity.- Returns:
- The true if identity present
-
hasVersion
public boolean hasVersion()Description copied from interface:PersistentEntityIs the entity versioned for optimistic locking.- Returns:
- true if versioned
-
getCompositeIdentity
Description copied from interface:PersistentEntityThe composite id. The method will throw an exception if there is none or one identity.PersistentEntity.hasCompositeIdentity()should be used to check for presence of identity.- Returns:
- The composite id or null if there isn't one
-
getIdentity
Description copied from interface:PersistentEntityReturns the identity of the instance. The method will throw an exception if there is none or more than one identity.PersistentEntity.hasIdentity()should be used to check for presence of identity.- Returns:
- The identity or null if there isn't one
-
getVersion
Description copied from interface:PersistentEntityReturns the version property. The method will throw an exception if there is no version property. UsePersistentEntity.hasVersion()to check for presence of version.- Returns:
- the property
-
getIdentityProperties
Description copied from interface:PersistentEntityReturns all identity properties.- Returns:
- The identity properties
-
getRuntimeIdentityProperties
An alternative togetIdentityProperties()but that returnsRuntimePersistentProperty.- Returns:
- The identity properties
-
getPersistentProperties
Description copied from interface:PersistentEntityA list of properties to be persisted.- Returns:
- A list of PersistentProperty instances
-
getAssociations
Description copied from interface:PersistentEntityA list of the associations for this entity. This is typically a subset of the list returned byPersistentEntity.getPersistentProperties()- Returns:
- A list of associations
-
getPropertyByName
Description copied from interface:PersistentEntityGets a PersistentProperty instance by name.- Parameters:
name- The name of the property- Returns:
- The PersistentProperty or null if it doesn't exist
-
getPropertyByNameIgnoreCase
Description copied from interface:PersistentEntityGets a PersistentProperty instance by name ignoring the case.- Parameters:
name- The name of the property- Returns:
- The PersistentProperty or null if it doesn't exist
-
getIdentityByName
Description copied from interface:PersistentEntityObtains an identity PersistentProperty instance by name.- Parameters:
name- The name of the identity property- Returns:
- The PersistentProperty or null if it doesn't exist
-
getPersistentPropertyNames
Description copied from interface:PersistentEntityA list of property names that a persistent.- Returns:
- A List of strings
-
isOwningEntity
Description copied from interface:PersistentEntityReturns whether the specified entity asserts ownership over this entity.- Parameters:
owner- The owning entity- Returns:
- True if it does own this entity
-
getParentEntity
Description copied from interface:PersistentEntityReturns the parent entity of this entity.- Returns:
- The ParentEntity instance
-
getEntity
Obtain an entity for the given type.- Parameters:
type- The type- Returns:
- The entity
- Throws:
io.micronaut.core.beans.exceptions.IntrospectionException- if the entity doesn't exist
-
getConstructorArguments
- Returns:
- The constructor arguments.
-
hasAutoPopulatedProperties
public boolean hasAutoPopulatedProperties()- Returns:
- Returns true if the entity has auto-populated properties.
-