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.annotation.MutableAnnotationMetadataDelegate<io.micronaut.inject.ast.Element>, 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 of PersistentEntity that operates on the sources.
Since:
1.0
Author:
graemerocher
  • Field Summary

    Fields inherited from interface io.micronaut.core.annotation.AnnotationMetadata

    CLASS_NAME_SUFFIX, EMPTY_METADATA, VALUE_MEMBER

    Fields inherited from interface io.micronaut.core.annotation.AnnotationSource

    EMPTY

    Fields inherited from interface io.micronaut.inject.ast.Element

    EMPTY_ELEMENT_ARRAY

    Fields inherited from interface io.micronaut.inject.ast.annotation.MutableAnnotationMetadataDelegate

    EMPTY
  • Constructor Summary

    Constructors
    Constructor
    Description
    SourcePersistentEntity(io.micronaut.inject.ast.ClassElement classElement, Function<io.micronaut.inject.ast.ClassElement, SourcePersistentEntity> entityResolver)
    Default constructor.
  • Method Summary

    Modifier and Type
    Method
    Description
    io.micronaut.inject.ast.ClassElement
     
    The composite id.
    Returns the identity of the instance.
    Obtains an identity PersistentProperty instance by name.
    Returns all identity properties.
    Obtains a PersistentProperty representing id or version property by name.
    The entity name including any package prefix.
     
    Returns the parent entity of this entity.
    A list of properties to be persisted.
    A list of property names that a persistent.
    Gets a PersistentProperty instance by name.
    Gets a PersistentProperty instance by name ignoring the case.
     
    io.micronaut.inject.ast.ClassElement
     
    Returns the version property.
    boolean
    Has composite identity.
    boolean
    Has identity.
    boolean
    Is the entity versioned for optimistic locking.
    boolean
    Returns whether the specified entity asserts ownership over this entity.
    boolean
     
    boolean
     
     

    Methods inherited from class 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

    enumValuesSet, enumValuesSet, getValues, hasDeclaredStereotype, hasEvaluatedExpressions, hasStereotypeNonRepeating, isAnnotationPresent, isDeclaredAnnotationPresent

    Methods inherited from interface io.micronaut.core.annotation.AnnotationMetadataDelegate

    booleanValue, booleanValue, booleanValue, booleanValue, classValue, classValue, classValue, classValue, classValues, classValues, classValues, classValues, copyAnnotationMetadata, 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, getAnnotationValuesByName, getAnnotationValuesByStereotype, getAnnotationValuesByType, getDeclaredAnnotation, getDeclaredAnnotation, getDeclaredAnnotationNameByStereotype, getDeclaredAnnotationNames, getDeclaredAnnotationNamesByStereotype, getDeclaredAnnotationTypeByStereotype, getDeclaredAnnotationTypeByStereotype, getDeclaredAnnotationValuesByName, getDeclaredAnnotationValuesByType, getDeclaredMetadata, getDeclaredStereotypeAnnotationNames, getDefaultValue, getDefaultValue, getDefaultValue, getDefaultValue, getDefaultValues, getStereotypeAnnotationNames, getTargetAnnotationMetadata, 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, getDocumentation, getModifiers, isAbstract, isFinal, isPackagePrivate, isPrivate, isStatic, isSynthetic, removeAnnotation, removeAnnotation, removeAnnotationIf, removeStereotype, removeStereotype, withAnnotationMetadata

    Methods inherited from interface PersistentElement

    getPersistedName

    Methods inherited from interface io.micronaut.inject.ast.TypedElement

    getArrayDimensions, getGenericType, isArray, isPrimitive, isVoid
  • Constructor Details

    • SourcePersistentEntity

      public SourcePersistentEntity(io.micronaut.inject.ast.ClassElement classElement, Function<io.micronaut.inject.ast.ClassElement, SourcePersistentEntity> entityResolver)
      Default constructor.
      Parameters:
      classElement - The class element
      entityResolver - The entity resolver to resolve any additional entities such as associations
  • Method Details

    • getName

      public String getName()
      Description copied from interface: PersistentEntity
      The entity name including any package prefix.
      Specified by:
      getName in interface io.micronaut.inject.ast.Element
      Specified by:
      getName in interface io.micronaut.core.naming.Named
      Specified by:
      getName in interface PersistentEntity
      Returns:
      The entity name
    • getSimpleName

      public String getSimpleName()
      Specified by:
      getSimpleName in interface io.micronaut.inject.ast.Element
      Specified by:
      getSimpleName in interface PersistentEntity
      Returns:
      The simple name without the package of entity
    • isProtected

      public boolean isProtected()
      Specified by:
      isProtected in interface io.micronaut.inject.ast.Element
    • isPublic

      public boolean isPublic()
      Specified by:
      isPublic in interface io.micronaut.inject.ast.Element
    • getNativeType

      public Object getNativeType()
      Specified by:
      getNativeType in interface io.micronaut.inject.ast.Element
    • hasCompositeIdentity

      public boolean hasCompositeIdentity()
      Description copied from interface: PersistentEntity
      Has composite identity.
      Specified by:
      hasCompositeIdentity in interface PersistentEntity
      Returns:
      The true if composite identity present
    • hasIdentity

      public boolean hasIdentity()
      Description copied from interface: PersistentEntity
      Has identity.
      Specified by:
      hasIdentity in interface PersistentEntity
      Returns:
      The true if identity present
    • hasVersion

      public boolean hasVersion()
      Description copied from interface: PersistentEntity
      Is the entity versioned for optimistic locking.
      Specified by:
      hasVersion in interface PersistentEntity
      Returns:
      true if versioned
    • getCompositeIdentity

      public SourcePersistentProperty[] getCompositeIdentity()
      Description copied from interface: PersistentEntity
      The 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.
      Specified by:
      getCompositeIdentity in interface PersistentEntity
      Returns:
      The composite id or null if there isn't one
    • getIdentity

      public SourcePersistentProperty getIdentity()
      Description copied from interface: PersistentEntity
      Returns 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.
      Specified by:
      getIdentity in interface PersistentEntity
      Returns:
      The identity or null if there isn't one
    • getIdentityProperties

      public List<PersistentProperty> getIdentityProperties()
      Description copied from interface: PersistentEntity
      Returns all identity properties.
      Specified by:
      getIdentityProperties in interface PersistentEntity
      Returns:
      The identity properties
    • getVersion

      public SourcePersistentProperty getVersion()
      Description copied from interface: PersistentEntity
      Returns the version property. The method will throw an exception if there is no version property. Use PersistentEntity.hasVersion() to check for presence of version.
      Specified by:
      getVersion in interface PersistentEntity
      Returns:
      the property
    • getPersistentProperties

      public List<SourcePersistentProperty> getPersistentProperties()
      Description copied from interface: PersistentEntity
      A list of properties to be persisted.
      Specified by:
      getPersistentProperties in interface PersistentEntity
      Returns:
      A list of PersistentProperty instances
    • getPropertyByName

      public @Nullable SourcePersistentProperty getPropertyByName(String name)
      Description copied from interface: PersistentEntity
      Gets a PersistentProperty instance by name.
      Specified by:
      getPropertyByName in interface PersistentEntity
      Parameters:
      name - The name of the property
      Returns:
      The PersistentProperty or null if it doesn't exist
    • getPropertyByNameIgnoreCase

      public @Nullable SourcePersistentProperty getPropertyByNameIgnoreCase(String name)
      Description copied from interface: PersistentEntity
      Gets a PersistentProperty instance by name ignoring the case.
      Specified by:
      getPropertyByNameIgnoreCase in interface PersistentEntity
      Parameters:
      name - The name of the property
      Returns:
      The PersistentProperty or null if it doesn't exist
    • getIdentityByName

      public @Nullable SourcePersistentProperty getIdentityByName(String name)
      Description copied from interface: PersistentEntity
      Obtains an identity PersistentProperty instance by name.
      Specified by:
      getIdentityByName in interface PersistentEntity
      Parameters:
      name - The name of the identity property
      Returns:
      The PersistentProperty or null if it doesn't exist
    • getIdOrVersionPropertyByName

      public @Nullable SourcePersistentProperty getIdOrVersionPropertyByName(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

      public List<String> getPersistentPropertyNames()
      Description copied from interface: PersistentEntity
      A list of property names that a persistent.
      Specified by:
      getPersistentPropertyNames in interface PersistentEntity
      Returns:
      A List of strings
    • isOwningEntity

      public boolean isOwningEntity(PersistentEntity owner)
      Description copied from interface: PersistentEntity
      Returns whether the specified entity asserts ownership over this entity.
      Specified by:
      isOwningEntity in interface PersistentEntity
      Parameters:
      owner - The owning entity
      Returns:
      True if it does own this entity
    • getParentEntity

      public @Nullable PersistentEntity getParentEntity()
      Description copied from interface: PersistentEntity
      Returns the parent entity of this entity.
      Specified by:
      getParentEntity in interface PersistentEntity
      Returns:
      The ParentEntity instance
    • getClassElement

      public io.micronaut.inject.ast.ClassElement getClassElement()
      Returns:
      The class element
    • getType

      public io.micronaut.inject.ast.ClassElement getType()
      Specified by:
      getType in interface io.micronaut.inject.ast.TypedElement
    • toString

      public String toString()
      Overrides:
      toString in class Object