Class MethodYield.ForImplementable

java.lang.Object
space.arim.dazzleconf.reflect.MethodYield.ForImplementable
All Implemented Interfaces:
AutoCloseable
Enclosing class:
MethodYield

public final class MethodYield.ForImplementable extends Object implements AutoCloseable
Builder of return value instructions, given an implementable class. When the caller is finished calling methods to add return values, they must close this object.
  • Constructor Details

    • ForImplementable

      public ForImplementable()
  • Method Details

    • returnValue

      public void returnValue(@NonNull MethodId method, @NonNull Object value)
      Specifies to return the given value. If the given method already has an instruction, it is replaced.

      If the given method is a covariant override of a method in a parent class, this function should be called twice, with appropriately different MethodIds.

      Parameters:
      method - a method within that interface
      value - the value to return
    • callDefaultImpl

      public void callDefaultImpl(@NonNull MethodId method)
      Specifies to invoke the default implementation. If the given method already has an instruction, it is replaced.

      If the given method exists in the current implementable class but was also overidden by a subclass, this method should be used for both classes.

      Parameters:
      method - a method within that interface
    • close

      public void close()
      Specified by:
      close in interface AutoCloseable