Class LambdaUtils

java.lang.Object
net.minheur.potoflux.utils.LambdaUtils

public class LambdaUtils extends Object
Utility class for lambas, mainly used in loading mods
  • Method Details

    • getImplMethod

      public static Method getImplMethod(Serializable lambda)
      Gets the real method implemented by the reference / lambda.
      Returns:
      the method declared in the impl class (where it exists).
    • getCapturingInstance

      public static Object getCapturingInstance(Object lambda)
      Tries to extract caught instance (this) if the reference method is an instance reference.
      WARNING: this works in most cases (method references non-static), but can fail for certains lambda types (ex : lambdas without captures).
      Parameters:
      lambda - method to extract from
      Returns:
      caught instance