Interface ParametersFilter

  • Functional Interface:
    This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

    @FunctionalInterface
    public interface ParametersFilter
    Filter for method or constructor parameters.

    Default filters created with static methods deal with variable arity executables in a expected way - they check if call could be called with specified arguments from equivalent source code call.

    • Method Detail

      • typesAccepted

        static ParametersFilter typesAccepted​(Type... parameterTypes)
        Creates filter that matches when specified types can be used as a arguments for tested executable.
        Parameters:
        parameterTypes - types of arguments that would be passed to executable
        Returns:
        filter that checks if the executable would accept specified argument types
      • typesExact

        static ParametersFilter typesExact​(Type... parameterTypes)
        Creates filter that matches when executable has exactly the provided parameters.
        Parameters:
        parameterTypes - types that are checked to be exactly parameters of executable
        Returns:
        filter that checks if the executable has exactly specified types of parameters
      • matchingArguments

        static ParametersFilter matchingArguments​(Object... arguments)
        Creates filter that checks if specified arguments by thier value could be passed to checked executable.
        Parameters:
        arguments - arguments that would be checked for passing to executable
        Returns:
        filter that checks if the executable would accept specified arguments
      • count

        static ParametersFilter count​(int count)
        Creates a filter that checks if executable could be called with the specified number of arguments.
        Parameters:
        count - number of arguments to check executable against
        Returns:
        filter that checks if executable can be called with specified count of arguments
      • matches

        boolean matches​(Parameter[] parameters,
                        boolean varArgs)
        Matches parameters of an executable against this filter.
        Parameters:
        parameters - parameters that checked executable has
        varArgs - if the executable is variable arity
        Returns:
        if the parameters are accepted by this filter
      • matches

        default boolean matches​(Executable executable)
        Matches executable for parameters.
        Parameters:
        executable - executable to test
        Returns:
        if the executable has parameters that are required by this filter