Package io.micronaut.data.model.runtime
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
public class RuntimePersistentEntity<T> extends AbstractPersistentEntity implements PersistentEntity
Runtime implementation ofPersistentEntitythat uses pre-computedIntrospectedbean data and is completely stateless.- Since:
- 1.0
- Author:
- graemerocher
-
-
Constructor Summary
Constructors Constructor Description RuntimePersistentEntity(io.micronaut.core.beans.BeanIntrospection<T> introspection)Default constructor.RuntimePersistentEntity(java.lang.Class<T> type)Default constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.StringgetAliasName()java.util.Collection<RuntimeAssociation<T>>getAssociations()A list of the associations for this entity.RuntimePersistentProperty<T>[]getCompositeIdentity()The composite id.RuntimePersistentProperty<T>[]getConstructorArguments()protected RuntimePersistentEntity<T>getEntity(java.lang.Class<T> type)Obtain an entity for the given type.RuntimePersistentProperty<T>getIdentity()Returns the identity of the instance.RuntimePersistentProperty<T>getIdentityByName(java.lang.String name)Obtains an identity PersistentProperty instance by name.io.micronaut.core.beans.BeanIntrospection<T>getIntrospection()java.lang.StringgetName()The entity name including any package prefix.PersistentEntitygetParentEntity()Returns the parent entity of this entity.java.util.Collection<RuntimePersistentProperty<T>>getPersistentProperties()A list of properties to be persisted.java.util.List<java.lang.String>getPersistentPropertyNames()A list of property names that a persistent.RuntimePersistentProperty<T>getPropertyByName(java.lang.String name)Obtains a PersistentProperty instance by name.RuntimePersistentProperty<T>getVersion()Returns the version property.booleanhasAutoPopulatedProperties()booleanhasCompositeIdentity()Has composite identity.booleanhasIdentity()Has identity.booleanhasPostLoadEventListeners()Does the entity have post-load event listeners.booleanhasPostPersistEventListeners()Does the entity have post-persist event listeners.booleanhasPostRemoveEventListeners()Does the entity have post-remove event listeners.booleanhasPostUpdateEventListeners()Does the entity have post-update event listeners.booleanhasPrePersistEventListeners()Does the entity have pre-persist event listeners.booleanhasPreRemoveEventListeners()Does the entity have pre-remove event listeners.booleanhasPreUpdateEventListeners()Does the entity have pre-update event listeners.booleanisOwningEntity(PersistentEntity owner)Returns whether the specified entity asserts ownership over this entity.protected AttributeConverter<java.lang.Object,java.lang.Object>resolveConverter(java.lang.Class<?> converterClass)Resolves a converter instance.java.lang.StringtoString()-
Methods inherited from class io.micronaut.data.model.AbstractPersistentEntity
equals, findNamingStrategy, getAnnotationMetadata, getNamingStrategy, getPersistedName, hashCode
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface io.micronaut.core.annotation.AnnotationMetadataProvider
findAnnotation, findAnnotation, findDeclaredAnnotation, findDeclaredAnnotation, getAnnotationMetadata, isAnnotationPresent, isDeclaredAnnotationPresent, synthesize, synthesizeAll, synthesizeAnnotationsByType, synthesizeDeclared, synthesizeDeclared, synthesizeDeclaredAnnotationsByType
-
Methods inherited from interface io.micronaut.core.annotation.AnnotationSource
getAnnotation, getAnnotation, getDeclaredAnnotation, getDeclaredAnnotation, isAnnotationPresent, isDeclaredAnnotationPresent, synthesize, synthesizeDeclared
-
Methods inherited from interface io.micronaut.data.model.PersistentElement
getPersistedName
-
Methods inherited from interface io.micronaut.data.model.PersistentEntity
findNamingStrategy, getDecapitalizedName, getEmbedded, getNamingStrategy, getPath, getPropertyByPath, getPropertyPath, getPropertyPath, getRootEntity, getSimpleName, isEmbeddable, isRoot, isVersioned
-
-
-
-
Constructor Detail
-
RuntimePersistentEntity
public RuntimePersistentEntity(@NonNull java.lang.Class<T> type)Default constructor.- Parameters:
type- The type
-
RuntimePersistentEntity
public RuntimePersistentEntity(@NonNull io.micronaut.core.beans.BeanIntrospection<T> introspection)Default constructor.- Parameters:
introspection- The introspection
-
-
Method Detail
-
resolveConverter
@NonNull protected AttributeConverter<java.lang.Object,java.lang.Object> resolveConverter(@NonNull java.lang.Class<?> converterClass)
Resolves a converter instance.- Parameters:
converterClass- The converter class- Returns:
- converter instance
-
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
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
getAliasName
@NonNull public java.lang.String getAliasName()
- Specified by:
getAliasNamein interfacePersistentEntity- Overrides:
getAliasNamein classAbstractPersistentEntity- Returns:
- A name to use when referring to this element via an alias.
-
getIntrospection
public io.micronaut.core.beans.BeanIntrospection<T> getIntrospection()
- Returns:
- The underlying introspection.
-
getName
@NonNull public java.lang.String getName()
Description copied from interface:PersistentEntityThe entity name including any package prefix.- Specified by:
getNamein interfaceio.micronaut.core.naming.Named- Specified by:
getNamein interfacePersistentEntity- Returns:
- The entity name
-
hasCompositeIdentity
public boolean hasCompositeIdentity()
Description copied from interface:PersistentEntityHas composite identity.- Specified by:
hasCompositeIdentityin interfacePersistentEntity- Returns:
- The true if composite identity present
-
hasIdentity
public boolean hasIdentity()
Description copied from interface:PersistentEntityHas identity.- Specified by:
hasIdentityin interfacePersistentEntity- Returns:
- The true if identity present
-
getCompositeIdentity
@Nullable public RuntimePersistentProperty<T>[] getCompositeIdentity()
Description copied from interface:PersistentEntityThe composite id.- Specified by:
getCompositeIdentityin interfacePersistentEntity- Returns:
- The composite id or null if there isn't one
-
getIdentity
@Nullable public RuntimePersistentProperty<T> getIdentity()
Description copied from interface:PersistentEntityReturns the identity of the instance.- Specified by:
getIdentityin interfacePersistentEntity- Returns:
- The identity or null if there isn't one
-
getVersion
@Nullable public RuntimePersistentProperty<T> getVersion()
Description copied from interface:PersistentEntityReturns the version property.- Specified by:
getVersionin interfacePersistentEntity- Returns:
- the property
-
getPersistentProperties
@NonNull public java.util.Collection<RuntimePersistentProperty<T>> getPersistentProperties()
Description copied from interface:PersistentEntityA list of properties to be persisted.- Specified by:
getPersistentPropertiesin interfacePersistentEntity- Returns:
- A list of PersistentProperty instances
-
getAssociations
@NonNull public java.util.Collection<RuntimeAssociation<T>> getAssociations()
Description copied from interface:PersistentEntityA list of the associations for this entity. This is typically a subset of the list returned byPersistentEntity.getPersistentProperties()- Specified by:
getAssociationsin interfacePersistentEntity- Returns:
- A list of associations
-
getPropertyByName
@Nullable public RuntimePersistentProperty<T> getPropertyByName(java.lang.String name)
Description copied from interface:PersistentEntityObtains a PersistentProperty instance by name.- Specified by:
getPropertyByNamein interfacePersistentEntity- Parameters:
name- The name of the property- Returns:
- The PersistentProperty or null if it doesn't exist
-
getIdentityByName
@Nullable public RuntimePersistentProperty<T> getIdentityByName(java.lang.String name)
Description copied from interface:PersistentEntityObtains an identity PersistentProperty instance by name.- Specified by:
getIdentityByNamein interfacePersistentEntity- Parameters:
name- The name of the identity property- Returns:
- The PersistentProperty or null if it doesn't exist
-
getPersistentPropertyNames
@NonNull public java.util.List<java.lang.String> getPersistentPropertyNames()
Description copied from interface:PersistentEntityA list of property names that a persistent.- Specified by:
getPersistentPropertyNamesin interfacePersistentEntity- Returns:
- A List of strings
-
isOwningEntity
public boolean isOwningEntity(PersistentEntity owner)
Description copied from interface:PersistentEntityReturns whether the specified entity asserts ownership over this entity.- Specified by:
isOwningEntityin interfacePersistentEntity- Parameters:
owner- The owning entity- Returns:
- True if it does own this entity
-
getParentEntity
@Nullable public PersistentEntity getParentEntity()
Description copied from interface:PersistentEntityReturns the parent entity of this entity.- Specified by:
getParentEntityin interfacePersistentEntity- Returns:
- The ParentEntity instance
-
getEntity
protected RuntimePersistentEntity<T> getEntity(java.lang.Class<T> type)
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
public RuntimePersistentProperty<T>[] getConstructorArguments()
- Returns:
- The constructor arguments.
-
hasAutoPopulatedProperties
public boolean hasAutoPopulatedProperties()
- Returns:
- Returns true if the entity has auto-populated properties.
-
-