Record Class RPCResultMapper<T>

java.lang.Object
java.lang.Record
eu.cloudnetservice.driver.impl.network.rpc.rpc.RPCResultMapper<T>
Type Parameters:
T - the generic expected result type of the rpc.
All Implemented Interfaces:
Function<eu.cloudnetservice.driver.network.protocol.Packet, T>

record RPCResultMapper<T>(@NonNull Type expectedResultType, @NonNull eu.cloudnetservice.driver.network.object.ObjectMapper objectMapper) extends Record implements Function<eu.cloudnetservice.driver.network.protocol.Packet, T>
The shared mapping function between the rpc chain and default rpc handling the result of a remote code execution and mapping the result in a convenient way.
Since:
4.0
  • Field Details

    • expectedResultType

      @NonNull private final @NonNull Type expectedResultType
      The field for the expectedResultType record component.
    • objectMapper

      @NonNull private final @NonNull eu.cloudnetservice.driver.network.object.ObjectMapper objectMapper
      The field for the objectMapper record component.
  • Constructor Details

    • RPCResultMapper

      RPCResultMapper(@NonNull @NonNull Type expectedResultType, @NonNull @NonNull eu.cloudnetservice.driver.network.object.ObjectMapper objectMapper)
      Creates an instance of a RPCResultMapper record class.
      Parameters:
      expectedResultType - the value for the expectedResultType record component
      objectMapper - the value for the objectMapper record component
  • Method Details

    • apply

      public @UnknownNullability T apply(@UnknownNullability eu.cloudnetservice.driver.network.protocol.Packet response)
      Specified by:
      apply in interface Function<eu.cloudnetservice.driver.network.protocol.Packet, T>
    • 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.
    • expectedResultType

      @NonNull public @NonNull Type expectedResultType()
      Returns the value of the expectedResultType record component.
      Returns:
      the value of the expectedResultType record component
    • objectMapper

      @NonNull public @NonNull eu.cloudnetservice.driver.network.object.ObjectMapper objectMapper()
      Returns the value of the objectMapper record component.
      Returns:
      the value of the objectMapper record component