Record Class ElementServiceQuery<ServiceT>

java.lang.Object
java.lang.Record
dev.getelements.elements.sdk.query.ElementServiceQuery<ServiceT>
Type Parameters:
ServiceT -
Record Components:
element -
serviceKey -
All Implemented Interfaces:
Query<ServiceT>, Supplier<ServiceT>

public record ElementServiceQuery<ServiceT>(Element element, ElementServiceKey<? extends ServiceT> serviceKey) extends Record implements Query<ServiceT>
The Query for the service from within an Element.
  • Constructor Details

    • ElementServiceQuery

      public ElementServiceQuery(Element element, ElementServiceKey<? extends ServiceT> serviceKey)
      Creates an instance of a ElementServiceQuery record class.
      Parameters:
      element - the value for the element record component
      serviceKey - the value for the serviceKey record component
  • Method Details

    • find

      public Optional<ServiceT> find() throws QueryException
      Description copied from interface: Query
      Gets the result of the Query
      Specified by:
      find in interface Query<ServiceT>
      Returns:
      the query result
      Throws:
      QueryException
    • callback

      public ElementCallbackQuery<? extends ServiceT> callback(String methodName, Class<?>... parameters)
      Queries fo ra Callback with the supplied method name and parameter types.
    • findCallback

      public Optional<ElementCallbackQuery<? extends ServiceT>> findCallback(String methodName, Class<?>... parameters)
      Queries for a Callback with the supplied method name and parameter types.
      Parameters:
      methodName - the method name
      parameters - the method parameters
      Returns:
      an ElementCallbackQuery
    • 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.
    • element

      public Element element()
      Returns the value of the element record component.
      Returns:
      the value of the element record component
    • serviceKey

      public ElementServiceKey<? extends ServiceT> serviceKey()
      Returns the value of the serviceKey record component.
      Returns:
      the value of the serviceKey record component