Class DynMethods.UnboundMethod

java.lang.Object
org.apache.iceberg.common.DynMethods.UnboundMethod
Direct Known Subclasses:
DynConstructors.Ctor
Enclosing class:
DynMethods

public static class DynMethods.UnboundMethod extends Object
Convenience wrapper class around Method.

Allows callers to invoke the wrapped method with all Exceptions wrapped by RuntimeException, or with a single Exception catch block.

  • Method Details

    • invoke

      public <R> R invoke(Object target, Object... args)
      Invokes the method on the given target, wrapping checked exceptions in a RuntimeException.
      Type Parameters:
      R - the return type of the method
      Parameters:
      target - the object to invoke the method on
      args - the arguments to pass to the method
      Returns:
      the result of the invocation
    • bind

      public DynMethods.BoundMethod bind(Object receiver)
      Returns this method as a BoundMethod for the given receiver.
      Parameters:
      receiver - an Object to receive the method invocation
      Returns:
      a DynMethods.BoundMethod for this method and the receiver
      Throws:
      IllegalStateException - if the method is static
      IllegalArgumentException - if the receiver's class is incompatible
    • isStatic

      public boolean isStatic()
      Returns whether the method is a static method.
      Returns:
      true if the method is static, false otherwise
    • isNoop

      public boolean isNoop()
      Returns whether the method is a noop.
      Returns:
      true if the method is a noop, false otherwise
    • asStatic

      public DynMethods.StaticMethod asStatic()
      Returns this method as a StaticMethod.
      Returns:
      a DynMethods.StaticMethod for this method
      Throws:
      IllegalStateException - if the method is not static
    • toString

      public String toString()
      Overrides:
      toString in class Object