Interface EnhancementOptions


public interface EnhancementOptions

Controls generated enhancement features and handling of unsupported classes. These choices are independent of the persistent attributes described by an EnhancementModel and the bytecode supplied by an EnhancementEnvironment.

An EnhancementSession may create enhancers with different options over the same model. Options must remain stable for each enhancer's lifetime and support concurrent queries when that enhancer is used concurrently. Client enhancers use disabled managed-generation flags; client field-access rewriting is selected by calling [Enhancer#enhanceClient(String, byte[])].

See Also:
  • Method Details

    • of

      static EnhancementOptions of(boolean dirtyTracking, boolean lazyInitialization, boolean associationManagement)
      Creates immutable settings for the three managed-generation features. Extended enhancement remains disabled and the unsupported-class policy is UnsupportedEnhancementStrategy.SKIP. Passing false for all three flags supplies the managed-generation settings for a client enhancer.
      Parameters:
      dirtyTracking - whether to generate inline dirty tracking
      lazyInitialization - whether to generate lazy-loading support for attributes permitted by the model
      associationManagement - whether to generate bidirectional association management
      Returns:
      options exposing these flags through the no-argument feature methods
    • doLazyInitialization

      default boolean doLazyInitialization()
      Whether to generate lazy-loading support. Attribute eligibility is separately determined by EnhancementModel.hasLazyLoadableAttributes(UnloadedClass) and EnhancementModel.isLazyLoadable(UnloadedField).
      Returns:
      true by default
    • getUnsupportedEnhancementStrategy

      default UnsupportedEnhancementStrategy getUnsupportedEnhancementStrategy()
      Selects the policy for unsupported mappings, such as property-access attributes whose accessor names do not match their underlying fields. This policy does not convert arbitrary transformation errors into skips.
      Returns:
      UnsupportedEnhancementStrategy.SKIP by default
    • doDirtyCheckingInline

      default boolean doDirtyCheckingInline()
      Whether to generate inline tracking of changes to persistent attributes. The default delegates to the deprecated class-argument method with null.
      Returns:
      true to generate dirty-tracking support
    • doExtendedEnhancement

      @Deprecated(forRemoval=true, since="7.1") default boolean doExtendedEnhancement()
      Deprecated, for removal: This API element is subject to removal in a future version.
      Use the separate Enhancer.enhanceClient(String, byte[]) operation instead.
      Whether the managed pass should also rewrite client field accesses using the legacy combined enhancement path. New integrations use the separate [Enhancer#enhanceClient(String, byte[])] operation.
      Returns:
      false by default
    • doBiDirectionalAssociationManagement

      @Deprecated(forRemoval=true, since="7.1") default boolean doBiDirectionalAssociationManagement()
      Deprecated, for removal: This API element is subject to removal in a future version.
      Will be removed without replacement. See HHH-19660
      Whether to generate automatic maintenance of the opposite side of a bidirectional association. The default delegates to the deprecated field-argument method with null.
      Returns:
      false by default
    • doDirtyCheckingInline

      @Deprecated(forRemoval=true) default boolean doDirtyCheckingInline(UnloadedClass classDescriptor)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Legacy class-argument form of doDirtyCheckingInline(). The no-argument default calls this method with null; enhancers do not use it to select different generation settings for individual classes.
      Parameters:
      classDescriptor - a class descriptor, possibly null; ignored by the default implementation
      Returns:
      true by default
    • doExtendedEnhancement

      @Deprecated(forRemoval=true, since="7.1") default boolean doExtendedEnhancement(UnloadedClass classDescriptor)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Legacy class-argument form of doExtendedEnhancement(). The no-argument default calls this method with null.
      Parameters:
      classDescriptor - a class descriptor, possibly null; ignored by the default implementation
      Returns:
      false by default
    • doBiDirectionalAssociationManagement

      @Deprecated(forRemoval=true, since="7.1") default boolean doBiDirectionalAssociationManagement(UnloadedField field)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Legacy field-argument form of doBiDirectionalAssociationManagement(). The no-argument default calls this method with null; enhancers do not use it to select different generation settings for individual associations.
      Parameters:
      field - a field descriptor, possibly null; ignored by the default implementation
      Returns:
      false by default