Package dev.runabout

Class MethodResolverBuilder


  • public class MethodResolverBuilder
    extends java.lang.Object
    A builder for the default implementation of MethodResolver. The default implementation will use a StackWalker to determine the first non-anonymous, non-lambda method that is not in the RunaboutService package. This builder provides ways to further filter the stack frames, so that the correct method is determined.
    • Constructor Detail

      • MethodResolverBuilder

        public MethodResolverBuilder()
    • Method Detail

      • setCallerClassBlacklist

        public MethodResolverBuilder setCallerClassBlacklist​(java.util.Set<java.lang.Class<?>> callerClassBlacklist)
        Sets the caller class blacklist for the MethodResolver. If provided, the blacklist will be used to filter out classes when determining the caller in the MethodResolver. A check for the existence in this set will be used in conjunction with the stack frame predicate.
        Parameters:
        callerClassBlacklist - Set of classes to avoid when resolving the method.
        Returns:
        The MethodResolverBuilder.
      • setStackFramePredicate

        public MethodResolverBuilder setStackFramePredicate​(java.util.function.Predicate<java.lang.StackWalker.StackFrame> stackFramePredicate)
        Sets the stack frame predicate for the MethodResolver. If provided, the predicate must only return true for a stack frames that should be considered when determining the method the scenario is being built over. The first stack frame to pass the predicate will be used.
        Parameters:
        stackFramePredicate - The stack frame predicate.
        Returns:
        The MethodResolverBuilder.