Record Class Trace

java.lang.Object
java.lang.Record
org.geysermc.conduit.Trace
Record Components:
returned - the value returned
calls - the instance calls made, in order
loader - the loader the value was read from

public record Trace(Value returned, List<Value.InstanceCall> calls, ClassLoader loader) extends Record
The result of evaluating a lambda or method reference, along with every instance call made while doing so.

Take a Supplier<Trace> in an Intercept handler to receive this instead of a conduit, for when the calls themselves matter as much as the value returned.

  • Constructor Details

    • Trace

      public Trace(Value returned, List<Value.InstanceCall> calls, ClassLoader loader)
      Creates an instance of a Trace record class.
      Parameters:
      returned - the value for the returned record component
      calls - the value for the calls record component
      loader - the value for the loader record component
  • Method Details

    • as

      public <T> T as(Class<T> conduit)
      Views the returned value through a conduit, along with the calls recorded while producing it.
      Type Parameters:
      T - the conduit type
      Parameters:
      conduit - the conduit interface
      Returns:
      the conduit, or null if the value can't be viewed as one
    • calls

      public List<Value.InstanceCall> calls(String method)
      Filters the recorded calls down to those made to one method.
      Parameters:
      method - the method name
      Returns:
      the recorded calls to methods with that name
    • 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.
    • returned

      public Value returned()
      Returns the value of the returned record component.
      Returns:
      the value of the returned record component
    • calls

      public List<Value.InstanceCall> calls()
      Returns the value of the calls record component.
      Returns:
      the value of the calls record component
    • loader

      public ClassLoader loader()
      Returns the value of the loader record component.
      Returns:
      the value of the loader record component