/** * Add a throwable exception that must match the given type exactly. * * @param type - exception type. * @return This builder, for chaining. */ public Builder exceptionExactType(Class<?> type) { member.exceptionMatchers.add(new ParameterClassMatcher(FuzzyMatchers.matchExact(type))); return this; }
/** * Add a throwable exception that must match the given type or be derived and index. * * @param type - exception type. * @param index - the position in the throwable list. * @return This builder, for chaining. */ public Builder exceptionSuperOf(Class<?> type, int index) { member.exceptionMatchers.add( new ParameterClassMatcher(FuzzyMatchers.matchSuper(type), index)); return this; }
/** * Set the expected super class of the return type for every matching method. * * @param type - the return type, or a super class of it. * @return This builder, for chaining. */ public Builder returnDerivedOf(Class<?> type) { member.returnMatcher = FuzzyMatchers.matchDerived(type); return this; }
/** * Set the return type of a matching method exactly. * * @param type - the exact return type. * @return This builder, for chaining. */ public Builder returnTypeExact(Class<?> type) { member.returnMatcher = FuzzyMatchers.matchExact(type); return this; }
/** * Add a new required parameter whose type must be a derived class of the given class. * * <p>If the method parameter has the type Integer, then the class Number here will match it. * * @param type - a type or more derived type of the matching parameter. * @param index - the expected position in the parameter list. * @return This builder, for chaining. */ public Builder parameterDerivedOf(Class<?> type, int index) { member.paramMatchers.add(new ParameterClassMatcher(FuzzyMatchers.matchDerived(type), index)); return this; }
/** * Add a new required parameter by type and position for any matching method. * * @param type - the exact type this parameter must match. * @param index - the expected position in the parameter list. * @return This builder, for chaining. */ public Builder parameterExactType(Class<?> type, int index) { member.paramMatchers.add(new ParameterClassMatcher(FuzzyMatchers.matchExact(type), index)); return this; }
/** * Add a new required parameter whose type must be a superclass of the given type. * * <p>If a method parameter is of type Number, then any derived class here (Integer, Long, etc.) * will match it. * * @param type - a type or less derived type of the matching parameter. * @return This builder, for chaining. */ public Builder parameterSuperOf(Class<?> type) { member.paramMatchers.add(new ParameterClassMatcher(FuzzyMatchers.matchSuper(type))); return this; }