Class OneToOneEagerFieldResolver

java.lang.Object
io.github.blyznytsiaorg.bibernate.entity.type.OneToOneEagerFieldResolver
All Implemented Interfaces:
TypeFieldResolver

public class OneToOneEagerFieldResolver extends Object implements TypeFieldResolver
Implementation of TypeFieldResolver for resolving custom injection values for one-to-one eager fetch fields of an entity class.

This resolver is responsible for determining if a given field of an entity class represents a one-to-one eager fetch relationship and preparing the value to be injected into the field.

  • Constructor Details

    • OneToOneEagerFieldResolver

      public OneToOneEagerFieldResolver()
  • Method Details

    • isAppropriate

      public boolean isAppropriate(Field field)

      Determines if the resolver is appropriate for the given field. This implementation returns true if the field is annotated with OneToOne and the fetch type is FetchType.EAGER.

      Specified by:
      isAppropriate in interface TypeFieldResolver
      Parameters:
      field - the field to be evaluated for custom injection
      Returns:
      true if the field represents a one-to-one eager fetch relationship, false otherwise
    • prepareValueForFieldInjection

      public Object prepareValueForFieldInjection(Field field, ResultSet resultSet, Object entity, EntityPersistent entityPersistent)

      Prepares the value to be injected into the specified field of the entity. This implementation extracts the value from the result set and populates the field based on the relationship type.

      Specified by:
      prepareValueForFieldInjection in interface TypeFieldResolver
      Parameters:
      field - the field to receive the injected value
      resultSet - the result set containing the data from which the value will be extracted
      entity - the entity object to which the field belongs
      entityPersistent - the persistent metadata associated with the entity
      Returns:
      the value to be injected into the field
      Throws:
      BibernateGeneralException - if an error occurs while populating the field