Package io.micronaut.data.model
Interface PersistentEntity
- All Superinterfaces:
- io.micronaut.core.annotation.AnnotationMetadataProvider,- io.micronaut.core.annotation.AnnotationSource,- io.micronaut.core.naming.Named,- PersistentElement
- All Known Implementing Classes:
- AbstractPersistentEntity,- RuntimePersistentEntity,- SourcePersistentEntity
Models a persistent entity and provides an API that can be used both within the compiler and at runtime. The 
AnnotationMetadata provided is consistent both at runtime and compilation time.- Since:
- 1.0
- Author:
- Graeme Rocher
- See Also:
- 
Field SummaryFields inherited from interface io.micronaut.core.annotation.AnnotationSourceEMPTY
- 
Method SummaryModifier and TypeMethodDescription@NonNull Optional<NamingStrategy>Find the naming strategy that is defined for the entity.@NonNull Stringdefault @NonNull Collection<? extends Association>A list of the associations for this entity.@Nullable PersistentProperty[]The composite id.default @NonNull Stringdefault @NonNull Collection<Embedded>A list of embedded associations for this entity.@Nullable PersistentPropertyReturns the identity of the instance.default @Nullable PersistentPropertygetIdentityByName(String name) Obtains an identity PersistentProperty instance by name.@NonNull StringgetName()The entity name including any package prefix.@NonNull NamingStrategyObtain the naming strategy for the entity.@Nullable PersistentEntityReturns the parent entity of this entity.Computes a dot separated property path for the given camel case path.@NonNull Collection<? extends PersistentProperty>A list of properties to be persisted.@NonNull Collection<String>A list of property names that a persistent.@Nullable PersistentPropertygetPropertyByName(String name) Obtains a PersistentProperty instance by name.default Optional<PersistentProperty>getPropertyByPath(String path) Return a property for a dot separated property path such asfoo.bar.prop.default @Nullable PersistentPropertyPathgetPropertyPath(@NonNull String path) Return aPersistentPropertyPathby path such asfoo.bar.prop.default @Nullable PersistentPropertyPathgetPropertyPath(@NonNull String[] propertyPath) Return aPersistentPropertyPathby path such asfoo.bar.prop.default @NonNull PersistentEntityObtains the root entity of an inheritance hierarchy.default @NonNull String@Nullable PersistentPropertyReturns the version property.default booleanHas composite identity.default booleanHas identity.default booleanbooleanisOwningEntity(PersistentEntity owner) Returns whether the specified entity asserts ownership over this entity.default booleanisRoot()Whether this entity is a root entity.default booleanIs the entity versioned for optimistic locking.static <T> @NonNull RuntimePersistentEntity<T>of(@NonNull io.micronaut.core.beans.BeanIntrospection<T> introspection) Creates a new persistent entity representation of the given type.static <T> @NonNull RuntimePersistentEntity<T>Creates a new persistent entity representation of the given type.Methods inherited from interface io.micronaut.core.annotation.AnnotationMetadataProviderfindAnnotation, findAnnotation, findDeclaredAnnotation, findDeclaredAnnotation, getAnnotationMetadata, getTargetAnnotationMetadata, isAnnotationPresent, isDeclaredAnnotationPresent, synthesize, synthesizeAll, synthesizeAnnotationsByType, synthesizeDeclared, synthesizeDeclared, synthesizeDeclaredAnnotationsByTypeMethods inherited from interface io.micronaut.core.annotation.AnnotationSourcegetAnnotation, getAnnotation, getDeclaredAnnotation, getDeclaredAnnotation, isAnnotationPresent, isDeclaredAnnotationPresent, synthesize, synthesizeDeclaredMethods inherited from interface io.micronaut.data.model.PersistentElementgetPersistedName
- 
Method Details- 
getNameThe entity name including any package prefix.- Specified by:
- getNamein interface- io.micronaut.core.naming.Named
- Returns:
- The entity name
 
- 
getAliasName- Returns:
- A name to use when referring to this element via an alias.
 
- 
hasCompositeIdentitydefault boolean hasCompositeIdentity()Has composite identity.- Returns:
- The true if composite identity present
 
- 
hasIdentitydefault boolean hasIdentity()Has identity.- Returns:
- The true if identity present
 
- 
getCompositeIdentityThe composite id.- Returns:
- The composite id or null if there isn't one
 
- 
getIdentityReturns the identity of the instance.- Returns:
- The identity or null if there isn't one
 
- 
getVersionReturns the version property.- Returns:
- the property
 
- 
isVersioneddefault boolean isVersioned()Is the entity versioned for optimistic locking.- Returns:
- true if versioned
 
- 
getPersistentPropertiesA list of properties to be persisted.- Returns:
- A list of PersistentProperty instances
 
- 
getAssociationsA list of the associations for this entity. This is typically a subset of the list returned bygetPersistentProperties()- Returns:
- A list of associations
 
- 
getEmbeddedA list of embedded associations for this entity. This is typically a subset of the list returned bygetPersistentProperties()- Returns:
- A list of associations
 
- 
getPropertyByNameObtains a PersistentProperty instance by name.- Parameters:
- name- The name of the property
- Returns:
- The PersistentProperty or null if it doesn't exist
 
- 
getIdentityByNameObtains an identity PersistentProperty instance by name.- Parameters:
- name- The name of the identity property
- Returns:
- The PersistentProperty or null if it doesn't exist
 
- 
getPersistentPropertyNamesA list of property names that a persistent.- Returns:
- A List of strings
 
- 
isEmbeddabledefault boolean isEmbeddable()- Returns:
- Is the entity embeddable.
 
- 
getSimpleName- Returns:
- The simple name without the package of entity
 
- 
getDecapitalizedName- Returns:
- Returns the name of the class decapitalized form
 
- 
isOwningEntityReturns whether the specified entity asserts ownership over this entity.- Parameters:
- owner- The owning entity
- Returns:
- True if it does own this entity
 
- 
getParentEntityReturns the parent entity of this entity.- Returns:
- The ParentEntity instance
 
- 
getPathComputes a dot separated property path for the given camel case path.- Parameters:
- camelCasePath- The camel case path
- Returns:
- The dot separated version or null if it cannot be computed
 
- 
getRootEntityObtains the root entity of an inheritance hierarchy.- Returns:
- The root entity
 
- 
isRootdefault boolean isRoot()Whether this entity is a root entity.- Returns:
- True if it is a root entity
 
- 
getPropertyByPathReturn a property for a dot separated property path such asfoo.bar.prop.- Parameters:
- path- The path
- Returns:
- The property
 
- 
getPropertyPathReturn aPersistentPropertyPathby path such asfoo.bar.prop. .- Parameters:
- path- The path
- Returns:
- The properties
 
- 
getPropertyPath@Nullable default @Nullable PersistentPropertyPath getPropertyPath(@NonNull @NonNull String[] propertyPath) Return aPersistentPropertyPathby path such asfoo.bar.prop. .- Parameters:
- propertyPath- The path
- Returns:
- The properties
 
- 
getNamingStrategyObtain the naming strategy for the entity.- Returns:
- The naming strategy
 
- 
findNamingStrategyFind the naming strategy that is defined for the entity.- Returns:
- The optional naming strategy
 
- 
ofCreates a new persistent entity representation of the given type. The type must be annotated withIntrospected. This method will create a new instance on demand and does not cache.- Type Parameters:
- T- The generic type
- Parameters:
- type- The type
- Returns:
- The entity
 
- 
of@NonNull static <T> @NonNull RuntimePersistentEntity<T> of(@NonNull @NonNull io.micronaut.core.beans.BeanIntrospection<T> introspection) Creates a new persistent entity representation of the given type. The type must be annotated withIntrospected. This method will create a new instance on demand and does not cache.- Type Parameters:
- T- The generic type
- Parameters:
- introspection- The introspection
- Returns:
- The entity
 
 
-