Record Class EmbeddedType

java.lang.Object
java.lang.Record
org.seasar.doma.jdbc.entity.EmbeddedType
Record Components:
prefix - the column name prefix to be prepended to embedded property columns
columnTypeMap - a map of property names to their column type overrides

public record EmbeddedType(String prefix, Map<String,ColumnType> columnTypeMap) extends Record
Represents the metadata for an embedded property within an entity.

This record encapsulates the configuration information for properties annotated with Embedded, including column name prefixes and column overrides. It is used internally by the Doma framework to manage how embeddable objects are mapped to database columns when embedded in entities.

The embedded type information is derived from the Embedded annotation and its attributes:

  • The prefix is applied to all column names of the embedded properties unless overridden
  • Column overrides provide fine-grained control over individual property mappings

This record is typically created during annotation processing and used at runtime for SQL generation and result set mapping.

See Also:
  • Constructor Details

    • EmbeddedType

      public EmbeddedType(String prefix, Map<String,ColumnType> columnTypeMap)
      Creates a new EmbeddedType instance.
      Parameters:
      prefix - the column name prefix (must not be null, can be empty string)
      columnTypeMap - the map of column overrides (must not be null, can be empty)
      Throws:
      NullPointerException - if prefix or columnTypeMap is null
  • Method Details

    • merge

      public EmbeddedType merge(EmbeddedType parent)
      Merges this EmbeddedType with a parent EmbeddedType to create a new EmbeddedType instance.

      This method is used to handle nested embeddable objects. When an embeddable object contains another embeddable object, this method combines the configuration from both the parent and child embedded types.

      The merging process combines:

      • Prefixes are concatenated (parent prefix + this prefix)
      • Column type maps are merged with parent mappings taking precedence over child mappings
      Parameters:
      parent - the parent EmbeddedType to merge with, can be null
      Returns:
      a new EmbeddedType with merged configuration, or this instance if parent is null
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared with Objects::equals(Object,Object).
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • prefix

      public String prefix()
      Returns the value of the prefix record component.
      Returns:
      the value of the prefix record component
    • columnTypeMap

      public Map<String,ColumnType> columnTypeMap()
      Returns the value of the columnTypeMap record component.
      Returns:
      the value of the columnTypeMap record component