Record Class OpenProxy.RecordingProxy<T>

java.lang.Object
java.lang.Record
cloud.opencode.base.reflect.proxy.OpenProxy.RecordingProxy<T>
Type Parameters:
T - the interface type | 接口类型
Enclosing class:
OpenProxy

public static record OpenProxy.RecordingProxy<T>(T proxy, List<OpenProxy.MethodCall> calls) extends Record
Recording proxy wrapper 记录代理包装器
Since:
JDK 25, opencode-base-reflect V1.0.0
Author:
Leon Soo www.LeonSoo.com
  • Constructor Details

    • RecordingProxy

      public RecordingProxy(T proxy, List<OpenProxy.MethodCall> calls)
      Creates an instance of a RecordingProxy record class.
      Parameters:
      proxy - the value for the proxy record component
      calls - the value for the calls record component
  • Method Details

    • getCallCount

      public int getCallCount()
      Gets the number of method calls 获取方法调用次数
      Returns:
      the count | 计数
    • wasCalled

      public boolean wasCalled(String methodName)
      Checks if a method was called 检查方法是否被调用
      Parameters:
      methodName - the method name | 方法名
      Returns:
      true if called | 如果被调用返回true
    • getCallsFor

      public List<OpenProxy.MethodCall> getCallsFor(String methodName)
      Gets calls for a specific method 获取特定方法的调用
      Parameters:
      methodName - the method name | 方法名
      Returns:
      list of calls | 调用列表
    • clearCalls

      public void clearCalls()
      Clears recorded calls 清除记录的调用
    • 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.
    • proxy

      public T proxy()
      Returns the value of the proxy record component.
      Returns:
      the value of the proxy record component
    • calls

      public List<OpenProxy.MethodCall> calls()
      Returns the value of the calls record component.
      Returns:
      the value of the calls record component