Interface Property<ENTITY,BASIC>

Type Parameters:
ENTITY - the entity type that contains this property
BASIC - the basic type that represents the property's value
All Superinterfaces:
JdbcMappable<BASIC>, JdbcMappingHint
All Known Implementing Classes:
DefaultPropertyType.DefaultProperty

public interface Property<ENTITY,BASIC> extends JdbcMappable<BASIC>
Represents a property of an entity class that can be mapped to a database column.

This interface defines methods for getting and setting property values on entity instances, as well as converting between entity property values and database column values.

Implementations of this interface are typically generated at compile time by the Doma annotation processor based on Entity annotated classes.

See Also:
  • Method Details

    • get

      Object get()
      Returns the current value of this property.

      The returned value may be wrapped in an Optional if the property is nullable.

      Returns:
      the current value of this property, possibly wrapped in an Optional
    • getAsNonOptional

      Object getAsNonOptional()
      Returns the non-optional value of this property.

      If the property value is wrapped in an Optional, this method unwraps it. This method may throw an exception if the property value is null.

      Returns:
      the non-optional value of this property
      Throws:
      NoSuchElementException - if the property value is null and wrapped in an Optional
    • load

      Property<ENTITY,BASIC> load(ENTITY entity)
      Loads the value from the entity into this property.

      This method extracts the property value from the given entity instance and stores it in this property object for later use.

      Parameters:
      entity - the entity instance to load the value from
      Returns:
      this property instance for method chaining
    • save

      Property<ENTITY,BASIC> save(ENTITY entity)
      Saves the current value of this property to the given entity instance.

      This method updates the property value in the given entity instance with the current value stored in this property object.

      Parameters:
      entity - the entity instance to save the value to
      Returns:
      this property instance for method chaining
    • asInParameter

      InParameter<BASIC> asInParameter()
      Returns this property as an InParameter for use in SQL execution.

      This method allows the property to be used as a parameter in SQL statements.

      Returns:
      an input parameter representing this property's value
      See Also: