Class SourcePersistentEntity
- java.lang.Object
-
- io.micronaut.data.model.AbstractPersistentEntity
-
- io.micronaut.data.processor.model.SourcePersistentEntity
-
- All Implemented Interfaces:
io.micronaut.core.annotation.AnnotatedElement,io.micronaut.core.annotation.AnnotationMetadata,io.micronaut.core.annotation.AnnotationMetadataDelegate,io.micronaut.core.annotation.AnnotationMetadataProvider,io.micronaut.core.annotation.AnnotationSource,io.micronaut.core.naming.Described,io.micronaut.core.naming.Named,PersistentElement,PersistentEntity,io.micronaut.inject.ast.Element,io.micronaut.inject.ast.TypedElement
@Internal public class SourcePersistentEntity extends AbstractPersistentEntity implements PersistentEntity, io.micronaut.inject.ast.TypedElement
An implementation ofPersistentEntitythat operates on the sources.- Since:
- 1.0
- Author:
- graemerocher
-
-
Constructor Summary
Constructors Constructor Description SourcePersistentEntity(io.micronaut.inject.ast.ClassElement classElement, java.util.function.Function<io.micronaut.inject.ast.ClassElement,SourcePersistentEntity> entityResolver)Default constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description io.micronaut.inject.ast.ClassElementgetClassElement()SourcePersistentProperty[]getCompositeIdentity()The composite id.SourcePersistentPropertygetIdentity()Returns the identity of the instance.SourcePersistentPropertygetIdentityByName(java.lang.String name)Obtains an identity PersistentProperty instance by name.SourcePersistentPropertygetIdOrVersionPropertyByName(java.lang.String name)Obtains a PersistentProperty representing id or version property by name.java.lang.StringgetName()The entity name including any package prefix.java.lang.ObjectgetNativeType()PersistentEntitygetParentEntity()Returns the parent entity of this entity.java.util.List<SourcePersistentProperty>getPersistentProperties()A list of properties to be persisted.java.util.List<java.lang.String>getPersistentPropertyNames()A list of property names that a persistent.SourcePersistentPropertygetPropertyByName(java.lang.String name)Obtains a PersistentProperty instance by name.java.lang.StringgetSimpleName()io.micronaut.inject.ast.ClassElementgetType()SourcePersistentPropertygetVersion()Returns the version property.booleanhasCompositeIdentity()Has composite identity.booleanhasIdentity()Has identity.booleanisOwningEntity(PersistentEntity owner)Returns whether the specified entity asserts ownership over this entity.booleanisProtected()booleanisPublic()java.lang.StringtoString()-
Methods inherited from class io.micronaut.data.model.AbstractPersistentEntity
equals, findNamingStrategy, getAliasName, 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.AnnotatedElement
isDeclaredNonNull, isDeclaredNullable, isNonNull, isNullable
-
Methods inherited from interface io.micronaut.core.annotation.AnnotationMetadata
getAnnotationValuesByName, getAnnotationValuesByStereotype, getDeclaredAnnotationValuesByName, getValues, hasDeclaredStereotype, isAnnotationPresent, isDeclaredAnnotationPresent
-
Methods inherited from interface io.micronaut.core.annotation.AnnotationMetadataDelegate
booleanValue, booleanValue, booleanValue, booleanValue, classValue, classValue, classValue, classValue, classValues, classValues, classValues, classValues, doubleValue, doubleValue, doubleValue, enumValue, enumValue, enumValue, enumValue, enumValues, enumValues, enumValues, enumValues, findAnnotation, findAnnotation, findDeclaredAnnotation, findDeclaredAnnotation, findRepeatableAnnotation, findRepeatableAnnotation, getAnnotation, getAnnotation, getAnnotationNameByStereotype, getAnnotationNameByStereotype, getAnnotationNames, getAnnotationNamesByStereotype, getAnnotationNamesByStereotype, getAnnotationType, getAnnotationType, getAnnotationTypeByStereotype, getAnnotationTypeByStereotype, getAnnotationTypesByStereotype, getAnnotationTypesByStereotype, getAnnotationTypesByStereotype, getAnnotationValuesByType, getDeclaredAnnotation, getDeclaredAnnotation, getDeclaredAnnotationNameByStereotype, getDeclaredAnnotationNames, getDeclaredAnnotationNamesByStereotype, getDeclaredAnnotationTypeByStereotype, getDeclaredAnnotationTypeByStereotype, getDeclaredAnnotationValuesByType, getDeclaredMetadata, getDeclaredStereotypeAnnotationNames, getDefaultValue, getDefaultValue, getDefaultValue, getDefaultValue, getDefaultValues, getStereotypeAnnotationNames, getValue, getValue, getValue, getValue, getValue, getValue, getValue, getValue, getValue, getValue, getValue, getValue, getValues, getValues, hasAnnotation, hasAnnotation, hasDeclaredAnnotation, hasDeclaredAnnotation, hasDeclaredStereotype, hasDeclaredStereotype, hasDeclaredStereotype, hasPropertyExpressions, hasSimpleAnnotation, hasSimpleDeclaredAnnotation, hasStereotype, hasStereotype, hasStereotype, hasStereotype, intValue, intValue, intValue, isAnnotationPresent, isDeclaredAnnotationPresent, isEmpty, isFalse, isFalse, isPresent, isPresent, isRepeatableAnnotation, isRepeatableAnnotation, isTrue, isTrue, longValue, longValue, stringValue, stringValue, stringValue, stringValue, stringValues, stringValues, stringValues, stringValues, synthesize, synthesize, synthesizeAll, synthesizeAnnotationsByType, synthesizeDeclared, synthesizeDeclared, synthesizeDeclared, synthesizeDeclaredAnnotationsByType
-
Methods inherited from interface io.micronaut.core.annotation.AnnotationMetadataProvider
getAnnotationMetadata
-
Methods inherited from interface io.micronaut.inject.ast.Element
annotate, annotate, annotate, annotate, annotate, getDescription, getDescription, getDocumentation, getModifiers, isAbstract, isFinal, isPackagePrivate, isPrivate, isStatic, removeAnnotation, removeAnnotation, removeAnnotationIf, removeStereotype, removeStereotype
-
Methods inherited from interface io.micronaut.data.model.PersistentElement
getPersistedName
-
Methods inherited from interface io.micronaut.data.model.PersistentEntity
findNamingStrategy, getAliasName, getAssociations, getDecapitalizedName, getEmbedded, getNamingStrategy, getPath, getPropertyByPath, getPropertyPath, getPropertyPath, getRootEntity, isEmbeddable, isRoot, isVersioned
-
-
-
-
Constructor Detail
-
SourcePersistentEntity
public SourcePersistentEntity(@NonNull io.micronaut.inject.ast.ClassElement classElement, @NonNull java.util.function.Function<io.micronaut.inject.ast.ClassElement,SourcePersistentEntity> entityResolver)Default constructor.- Parameters:
classElement- The class elemententityResolver- The entity resolver to resolve any additional entities such as associations
-
-
Method Detail
-
getName
@NonNull public java.lang.String getName()
Description copied from interface:PersistentEntityThe entity name including any package prefix.- Specified by:
getNamein interfaceio.micronaut.inject.ast.Element- Specified by:
getNamein interfaceio.micronaut.core.naming.Named- Specified by:
getNamein interfacePersistentEntity- Returns:
- The entity name
-
getSimpleName
public java.lang.String getSimpleName()
- Specified by:
getSimpleNamein interfaceio.micronaut.inject.ast.Element- Specified by:
getSimpleNamein interfacePersistentEntity- Returns:
- The simple name without the package of entity
-
isProtected
public boolean isProtected()
- Specified by:
isProtectedin interfaceio.micronaut.inject.ast.Element
-
isPublic
public boolean isPublic()
- Specified by:
isPublicin interfaceio.micronaut.inject.ast.Element
-
getNativeType
public java.lang.Object getNativeType()
- Specified by:
getNativeTypein interfaceio.micronaut.inject.ast.Element
-
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 SourcePersistentProperty[] 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 SourcePersistentProperty 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 SourcePersistentProperty getVersion()
Description copied from interface:PersistentEntityReturns the version property.- Specified by:
getVersionin interfacePersistentEntity- Returns:
- the property
-
getPersistentProperties
@NonNull public java.util.List<SourcePersistentProperty> getPersistentProperties()
Description copied from interface:PersistentEntityA list of properties to be persisted.- Specified by:
getPersistentPropertiesin interfacePersistentEntity- Returns:
- A list of PersistentProperty instances
-
getPropertyByName
@Nullable public SourcePersistentProperty 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 SourcePersistentProperty 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
-
getIdOrVersionPropertyByName
public SourcePersistentProperty getIdOrVersionPropertyByName(java.lang.String name)
Obtains a PersistentProperty representing id or version property by name.- Parameters:
name- The name of the id or version property- Returns:
- The PersistentProperty used as id or version 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
-
getClassElement
public io.micronaut.inject.ast.ClassElement getClassElement()
- Returns:
- The class element
-
getType
@NonNull public io.micronaut.inject.ast.ClassElement getType()
- Specified by:
getTypein interfaceio.micronaut.inject.ast.TypedElement
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-