Record Class AnyProjectionReference<SR,T>

java.lang.Object
java.lang.Record
org.hibernate.search.engine.search.reference.projection.AnyProjectionReference<SR,T>
Type Parameters:
SR - Scope root type
T - The type of the projected field.
Record Components:
absolutePath - The absolut field path.
scopeRootType - The class representing the scope root type.
valueModel - The model of projected values. See ValueModel.
projectionType - The class representing the type of the projected field, as per valueModel.
All Implemented Interfaces:
FieldReference<SR>, DistanceProjectionFieldReference<SR>, FieldProjectionFieldReference<SR,T>, HighlightProjectionFieldReference<SR>, ObjectProjectionFieldReference<SR>, ProjectionFieldReference<SR>, TypedProjectionFieldReference<SR,T>

@Incubating public record AnyProjectionReference<SR,T>(String absolutePath, Class<SR> scopeRootType, ValueModel valueModel, Class<T> projectionType) extends Record implements DistanceProjectionFieldReference<SR>, FieldProjectionFieldReference<SR,T>, HighlightProjectionFieldReference<SR>, ObjectProjectionFieldReference<SR>
A generic projected-field reference that can be manually created and passed to any projection-DSL methods that require a field reference.

While it is expected that the generated Hibernate Search static metamodel will contain more precise field references that would match the actual field capabilities, this generic reference can be used by the users if they decide to opt-out of using the generated static metamodel and would just want to create a few simple pre-defined references.

  • Constructor Details

    • AnyProjectionReference

      public AnyProjectionReference(String absolutePath, Class<SR> scopeRootType, ValueModel valueModel, Class<T> projectionType)
      Creates an instance of a AnyProjectionReference record class.
      Parameters:
      absolutePath - the value for the absolutePath record component
      scopeRootType - the value for the scopeRootType record component
      valueModel - the value for the valueModel record component
      projectionType - the value for the projectionType 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.
    • absolutePath

      public String absolutePath()
      Returns the value of the absolutePath record component.
      Specified by:
      absolutePath in interface FieldReference<SR>
      Returns:
      the value of the absolutePath record component
    • scopeRootType

      public Class<SR> scopeRootType()
      Returns the value of the scopeRootType record component.
      Specified by:
      scopeRootType in interface FieldReference<SR>
      Returns:
      the value of the scopeRootType record component
    • valueModel

      public ValueModel valueModel()
      Returns the value of the valueModel record component.
      Specified by:
      valueModel in interface TypedProjectionFieldReference<SR,T>
      Returns:
      the value of the valueModel record component
    • projectionType

      public Class<T> projectionType()
      Returns the value of the projectionType record component.
      Specified by:
      projectionType in interface TypedProjectionFieldReference<SR,T>
      Returns:
      the value of the projectionType record component