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 columnscolumnTypeMap- a map of property names to their column type overrides
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 Summary
ConstructorsConstructorDescriptionEmbeddedType(String prefix, Map<String, ColumnType> columnTypeMap) Creates a new EmbeddedType instance. -
Method Summary
Modifier and TypeMethodDescriptionReturns the value of thecolumnTypeMaprecord component.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.merge(EmbeddedType parent) Merges this EmbeddedType with a parent EmbeddedType to create a new EmbeddedType instance.prefix()Returns the value of theprefixrecord component.final StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
EmbeddedType
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
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
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. -
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. -
equals
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 withObjects::equals(Object,Object). -
prefix
Returns the value of theprefixrecord component.- Returns:
- the value of the
prefixrecord component
-
columnTypeMap
Returns the value of thecolumnTypeMaprecord component.- Returns:
- the value of the
columnTypeMaprecord component
-