Interface Initializer<Data extends InitializerData>

    • Field Detail

      • EMPTY_ARRAY

        static final Initializer<?>[] EMPTY_ARRAY
    • Method Detail

      • findOwningEntityInitializer

        default @Nullable EntityInitializer<?> findOwningEntityInitializer()
        Find the entity initializer that owns this initializer by traversing up getParent().
      • findOwningEntityInitializer

        static @Nullable EntityInitializer<?> findOwningEntityInitializer​(@Nullable Initializer<?> parent)
        Find the entity initializer that owns this initializer by traversing up getParent().
      • getInitializedPart

        ModelPart getInitializedPart()
      • getResolvedInstance

        default Object getResolvedInstance​(Data data)
      • resolveKey

        void resolveKey​(Data data)
        Step 1.1 - Resolve the key value for this initializer for the current row and then recurse to the sub-initializers. After this point, the initializer knows whether further processing is necessary for the current row i.e. if the object is missing.
      • resolveFromPreviousRow

        default void resolveFromPreviousRow​(Data data)
        Step 1.2 - Special variant of resolveKey(InitializerData) that allows the reuse of key value and instance value from the previous row.
        Implementation Specification:
        Defaults to simply delegating to resolveKey(InitializerData).
      • resolveFromPreviousRow

        default void resolveFromPreviousRow​(RowProcessingState rowProcessingState)
      • resolveInstance

        void resolveInstance​(Data data)
        Step 2.1 - Using the key resolved in resolveKey(Data), resolve the instance (of the thing initialized) to use for the current row. After this point, the initializer knows the entity/collection/component instance for the current row based on the resolved key. If the resolving was successful, getResolvedInstance(RowProcessingState) will return that instance.
      • resolveInstance

        default void resolveInstance​(RowProcessingState rowProcessingState)
      • resolveState

        void resolveState​(Data data)
      • resolveInstance

        default void resolveInstance​(@Nullable Object instance,
                                     Data data)
        Step 2.2 - Use the given instance as resolved instance for this initializer. Initializers are supposed to recursively call this method for sub-initializers. This alternative initialization protocol is used when a parent instance was already part of the persistence context.
      • initializeInstance

        void initializeInstance​(Data data)
        Step 3 - Initialize the state of the instance resolved in resolveInstance(Data) from the current row values. All resolved state for the current row is injected into the resolved instance
      • initializeInstance

        default void initializeInstance​(RowProcessingState rowProcessingState)
      • initializeInstanceFromParent

        default void initializeInstanceFromParent​(Object parentInstance,
                                                  Data data)
        Step 3.1 - Initialize the state of the instance as extracted from the given parentInstance. Extraction can be done with the getInitializedPart(). Initializers are supposed to recursively call this method for sub-initializers. This alternative initialization protocol is used for shallow query cache hits, in which case there is no data available in the JdbcValuesCacheHit to initialize potentially lazy associations.
      • initializeInstanceFromParent

        default void initializeInstanceFromParent​(Object parentInstance,
                                                  RowProcessingState rowProcessingState)
      • finishUpRow

        void finishUpRow​(Data data)
        Lifecycle method called at the end of the current row processing. Provides ability to complete processing from the current row and prepare for the next row.
      • endLoading

        default void endLoading​(Data data)
        Lifecycle method called at the very end of the result values processing
      • isPartOfKey

        boolean isPartOfKey()
        Indicates whether this initializer is part of a key i.e. entity identifier, foreign key or collection key.
      • isEager

        boolean isEager()
        Indicates whether calling resolve is needed when the object for this initializer is initialized already.
      • isLazyCapable

        default boolean isLazyCapable()
        Indicates whether this initializer or one of its sub-parts could be made lazy.
      • hasLazySubInitializers

        boolean hasLazySubInitializers()
        Indicates whether this initializer has sub-initializers which are lazy.
      • isResultInitializer

        boolean isResultInitializer()
        Indicates if this is a result or fetch initializer.
      • isEmbeddableInitializer

        default boolean isEmbeddableInitializer()
      • isEntityInitializer

        default boolean isEntityInitializer()
      • isCollectionInitializer

        default boolean isCollectionInitializer()
      • asEntityInitializer

        default @Nullable EntityInitializer<?> asEntityInitializer()
        A utility method to avoid casting explicitly to EntityInitializer
        Returns:
        EntityInitializer if this is an instance of EntityInitializer otherwise null
      • asEmbeddableInitializer

        default @Nullable EmbeddableInitializer<?> asEmbeddableInitializer()
        A utility method to avoid casting explicitly to EmbeddableInitializer
        Returns:
        EmbeddableInitializer if this is an instance of EmbeddableInitializer otherwise null
      • asCollectionInitializer

        default @Nullable CollectionInitializer<?> asCollectionInitializer()
        A utility method to avoid casting explicitly to CollectionInitializer
        Returns:
        CollectionInitializer if this is an instance of CollectionInitializer otherwise null