Class MethodInvocationCacheKey

java.lang.Object
com.easydesk.cache.impl.MethodInvocationCacheKey
All Implemented Interfaces:
Serializable

public final class MethodInvocationCacheKey extends Object implements Serializable
An immutable cache key representing a single method invocation: the target instance (or, for a static method, a String identifying the class), the method name, and the arguments the method was called with.
Version:
$Id: MethodInvocationCacheKey.java 1 2024-06-10 00:00:00Z youngho.cho $
Author:
">Youngho Cho
See Also:
  • Constructor Details

    • MethodInvocationCacheKey

      public MethodInvocationCacheKey(Serializable instanceOrClass, String method, Serializable... args)
      Creates a cache key for a method call.
      Parameters:
      instanceOrClass - the object on which the method is invoked; if the method is static, a String naming the class is typically used instead
      method - the method name
      args - the method arguments, may be empty
  • Method Details

    • sameInstance

      public boolean sameInstance(Serializable instanceOrClass)
      Returns true if this key was created for a method invocation on the given instance (or class name, for static methods).
      Parameters:
      instanceOrClass - the instance or class name to compare against
      Returns:
      true if this key is for a method invocation on that instance/class
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object