Record Class MappedOneToMany

java.lang.Object
java.lang.Record
org.litebridge.orm.persistence.MappedOneToMany
Record Components:
mappedByField - Refers to the field accessor for the field on the "one" side that maps to the "many" side of the relationship.
collection - Refers to the field accessor for the collection on the "many" side that represents the related entities.
All Implemented Interfaces:
MappedFieldTarget

public record MappedOneToMany(FieldAccessor mappedByField, FieldAccessor collection) extends Record implements MappedFieldTarget
Represents a one-to-many relationship mapping in an object-relational mapping (ORM) context.

This record encapsulates metadata related to a one-to-many relationship between entities. Specifically, it includes information about the field on the "one" side of the relationship (mapped by) and the collection field on the "many" side.

Implements MappedFieldTarget, serving as a target for mapped fields in an ORM context.

  • Constructor Details

    • MappedOneToMany

      public MappedOneToMany(FieldAccessor mappedByField, FieldAccessor collection)
      Creates an instance of a MappedOneToMany record class.
      Parameters:
      mappedByField - the value for the mappedByField record component
      collection - the value for the collection record component
  • Method Details

    • 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.
    • mappedByField

      public FieldAccessor mappedByField()
      Returns the value of the mappedByField record component.
      Returns:
      the value of the mappedByField record component
    • collection

      public FieldAccessor collection()
      Returns the value of the collection record component.
      Returns:
      the value of the collection record component