Class 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 of PersistentEntity that uses pre-computed Introspected bean data and is completely stateless.
    Since:
    1.0
    • 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:
        toString in class java.lang.Object
      • getIntrospection

        public io.micronaut.core.beans.BeanIntrospection<T> getIntrospection()
        Returns:
        The underlying introspection.
      • getName

        @NonNull
        public java.lang.String getName()
        Description copied from interface: PersistentEntity
        The entity name including any package prefix.
        Specified by:
        getName in interface io.micronaut.core.naming.Named
        Specified by:
        getName in interface PersistentEntity
        Returns:
        The entity name
      • getPropertyByName

        @Nullable
        public RuntimePersistentProperty<T> getPropertyByName​(java.lang.String name)
        Description copied from interface: PersistentEntity
        Obtains 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
      • getIdentityByName

        @Nullable
        public RuntimePersistentProperty<T> getIdentityByName​(java.lang.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
      • getPersistentPropertyNames

        @NonNull
        public java.util.List<java.lang.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
      • 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
      • hasAutoPopulatedProperties

        public boolean hasAutoPopulatedProperties()
        Returns:
        Returns true if the entity has auto-populated properties.