public static class FuzzyMethodContract.Builder extends AbstractFuzzyMember.Builder<FuzzyMethodContract>
member
Constructor and Description |
---|
FuzzyMethodContract.Builder() |
Modifier and Type | Method and Description |
---|---|
FuzzyMethodContract.Builder |
banModifier(int modifier)
Add a given bit-field of modifers that will skip or ignore members.
|
FuzzyMethodContract |
build()
Build a new instance of this type.
|
FuzzyMethodContract.Builder |
declaringClassDerivedOf(java.lang.Class<?> declaringClass)
Require that a member is defined by this exact class, or any super class.
|
FuzzyMethodContract.Builder |
declaringClassExactType(java.lang.Class<?> declaringClass)
Require that a member is defined by this exact class.
|
FuzzyMethodContract.Builder |
declaringClassMatching(AbstractFuzzyMatcher<java.lang.Class<?>> classMatcher)
Require that a member is defined by a class that matches the given matcher.
|
FuzzyMethodContract.Builder |
declaringClassSuperOf(java.lang.Class<?> declaringClass)
Require that a member is defined by this exact class, or any super class.
|
FuzzyMethodContract.Builder |
exceptionExactType(java.lang.Class<?> type)
Add a throwable exception that must match the given type exactly.
|
FuzzyMethodContract.Builder |
exceptionExactType(java.lang.Class<?> type,
int index)
Add a throwable exception that must match the given type exactly and index.
|
FuzzyMethodContract.Builder |
exceptionMatches(AbstractFuzzyMatcher<java.lang.Class<?>> classMatcher)
Add a throwable exception that must match the given matcher,
|
FuzzyMethodContract.Builder |
exceptionMatches(AbstractFuzzyMatcher<java.lang.Class<?>> classMatcher,
int index)
Add a throwable exception that must match the given matcher and index.
|
FuzzyMethodContract.Builder |
exceptionSuperOf(java.lang.Class<?> type)
Add a throwable exception that must match the given type or be derived.
|
FuzzyMethodContract.Builder |
exceptionSuperOf(java.lang.Class<?> type,
int index)
Add a throwable exception that must match the given type or be derived and index.
|
protected FuzzyMethodContract |
initialMember()
Construct a new instance of the current type.
|
FuzzyMethodContract.Builder |
nameExact(java.lang.String name)
Set the exact name of the member we are matching.
|
FuzzyMethodContract.Builder |
nameRegex(java.util.regex.Pattern pattern)
Set the regular expression pattern that matches a members name.
|
FuzzyMethodContract.Builder |
nameRegex(java.lang.String regex)
Set the regular expresson that matches a members name.
|
FuzzyMethodContract.Builder |
parameterCount(int expectedCount)
Set the expected number of parameters in the matching method.
|
FuzzyMethodContract.Builder |
parameterDerivedOf(java.lang.Class<?> type)
Add a new required parameter whose type must be a derived class of the given class.
|
FuzzyMethodContract.Builder |
parameterDerivedOf(java.lang.Class<?> type,
int index)
Add a new required parameter whose type must be a derived class of the given class.
|
FuzzyMethodContract.Builder |
parameterExactArray(java.lang.Class<?>... types)
Add a new required parameters by type and order for any matching method.
|
FuzzyMethodContract.Builder |
parameterExactType(java.lang.Class<?> type)
Add a new required parameter by type for any matching method.
|
FuzzyMethodContract.Builder |
parameterExactType(java.lang.Class<?> type,
int index)
Add a new required parameter by type and position for any matching method.
|
FuzzyMethodContract.Builder |
parameterMatches(AbstractFuzzyMatcher<java.lang.Class<?>> classMatcher)
Add a new required parameter whose type must match the given class matcher.
|
FuzzyMethodContract.Builder |
parameterMatches(AbstractFuzzyMatcher<java.lang.Class<?>> classMatcher,
int index)
Add a new required parameter whose type must match the given class matcher and index.
|
FuzzyMethodContract.Builder |
parameterSuperOf(java.lang.Class<?> type)
Add a new required parameter whose type must be a superclass of the given type.
|
FuzzyMethodContract.Builder |
parameterSuperOf(java.lang.Class<?> type,
int index)
Add a new required parameter whose type must be a superclass of the given type.
|
FuzzyMethodContract.Builder |
requireModifier(int modifier)
Add a given bit-field of required modifiers for every matching member.
|
FuzzyMethodContract.Builder |
requirePublic()
Require that every matching member is public.
|
FuzzyMethodContract.Builder |
returnDerivedOf(java.lang.Class<?> type)
Set the expected super class of the return type for every matching method.
|
FuzzyMethodContract.Builder |
returnTypeExact(java.lang.Class<?> type)
Set the return type of a matching method exactly.
|
FuzzyMethodContract.Builder |
returnTypeMatches(AbstractFuzzyMatcher<java.lang.Class<?>> classMatcher)
Set a matcher that must match the return type of a matching method.
|
FuzzyMethodContract.Builder |
returnTypeVoid()
Require a void method.
|
public FuzzyMethodContract.Builder requireModifier(int modifier)
AbstractFuzzyMember.Builder
requireModifier
in class AbstractFuzzyMember.Builder<FuzzyMethodContract>
modifier
- - bit-field of modifiers that are required.public FuzzyMethodContract.Builder requirePublic()
AbstractFuzzyMember.Builder
requirePublic
in class AbstractFuzzyMember.Builder<FuzzyMethodContract>
public FuzzyMethodContract.Builder banModifier(int modifier)
AbstractFuzzyMember.Builder
banModifier
in class AbstractFuzzyMember.Builder<FuzzyMethodContract>
modifier
- - bit-field of modifiers to skip or ignore.public FuzzyMethodContract.Builder nameRegex(java.lang.String regex)
AbstractFuzzyMember.Builder
nameRegex
in class AbstractFuzzyMember.Builder<FuzzyMethodContract>
regex
- - new regular expression of valid names.public FuzzyMethodContract.Builder nameRegex(java.util.regex.Pattern pattern)
AbstractFuzzyMember.Builder
nameRegex
in class AbstractFuzzyMember.Builder<FuzzyMethodContract>
pattern
- - regular expression pattern for a valid name.public FuzzyMethodContract.Builder nameExact(java.lang.String name)
AbstractFuzzyMember.Builder
nameExact
in class AbstractFuzzyMember.Builder<FuzzyMethodContract>
name
- - exact name.public FuzzyMethodContract.Builder declaringClassExactType(java.lang.Class<?> declaringClass)
AbstractFuzzyMember.Builder
declaringClassExactType
in class AbstractFuzzyMember.Builder<FuzzyMethodContract>
declaringClass
- - the declaring class of any matching member.public FuzzyMethodContract.Builder declaringClassSuperOf(java.lang.Class<?> declaringClass)
AbstractFuzzyMember.Builder
declaringClassSuperOf
in class AbstractFuzzyMember.Builder<FuzzyMethodContract>
declaringClass
- - the declaring class.public FuzzyMethodContract.Builder declaringClassDerivedOf(java.lang.Class<?> declaringClass)
AbstractFuzzyMember.Builder
declaringClassDerivedOf
in class AbstractFuzzyMember.Builder<FuzzyMethodContract>
declaringClass
- - the declaring class.public FuzzyMethodContract.Builder declaringClassMatching(AbstractFuzzyMatcher<java.lang.Class<?>> classMatcher)
AbstractFuzzyMember.Builder
declaringClassMatching
in class AbstractFuzzyMember.Builder<FuzzyMethodContract>
classMatcher
- - class matcher.public FuzzyMethodContract.Builder parameterExactType(java.lang.Class<?> type)
type
- - the exact type this parameter must match.public FuzzyMethodContract.Builder parameterSuperOf(java.lang.Class<?> type)
If a method parameter is of type Number, then any derived class here (Integer, Long, etc.) will match it.
type
- - a type or less derived type of the matching parameter.public FuzzyMethodContract.Builder parameterDerivedOf(java.lang.Class<?> type)
If the method parameter has the type Integer, then the class Number here will match it.
type
- - a type or more derived type of the matching parameter.public FuzzyMethodContract.Builder parameterMatches(AbstractFuzzyMatcher<java.lang.Class<?>> classMatcher)
classMatcher
- - the class matcher.public FuzzyMethodContract.Builder parameterExactType(java.lang.Class<?> type, int index)
type
- - the exact type this parameter must match.index
- - the expected position in the parameter list.public FuzzyMethodContract.Builder parameterExactArray(java.lang.Class<?>... types)
type
- - the types of every parameters in order.public FuzzyMethodContract.Builder parameterSuperOf(java.lang.Class<?> type, int index)
If a parameter is of type Number, any derived class (Integer, Long, etc.) will match it.
type
- - a type or derived type of the matching parameter.index
- - the expected position in the parameter list.public FuzzyMethodContract.Builder parameterDerivedOf(java.lang.Class<?> type, int index)
If the method parameter has the type Integer, then the class Number here will match it.
type
- - a type or more derived type of the matching parameter.index
- - the expected position in the parameter list.public FuzzyMethodContract.Builder parameterMatches(AbstractFuzzyMatcher<java.lang.Class<?>> classMatcher, int index)
classMatcher
- - the class matcher.index
- - the expected position in the parameter list.public FuzzyMethodContract.Builder parameterCount(int expectedCount)
expectedCount
- - the number of parameters to expect.public FuzzyMethodContract.Builder returnTypeVoid()
public FuzzyMethodContract.Builder returnTypeExact(java.lang.Class<?> type)
type
- - the exact return type.public FuzzyMethodContract.Builder returnDerivedOf(java.lang.Class<?> type)
type
- - the return type, or a super class of it.public FuzzyMethodContract.Builder returnTypeMatches(AbstractFuzzyMatcher<java.lang.Class<?>> classMatcher)
classMatcher
- - the exact return type.public FuzzyMethodContract.Builder exceptionExactType(java.lang.Class<?> type)
type
- - exception type.public FuzzyMethodContract.Builder exceptionSuperOf(java.lang.Class<?> type)
type
- - exception type.public FuzzyMethodContract.Builder exceptionMatches(AbstractFuzzyMatcher<java.lang.Class<?>> classMatcher)
classMatcher
- - the class matcher that must match.public FuzzyMethodContract.Builder exceptionExactType(java.lang.Class<?> type, int index)
type
- - exception type.index
- - the position in the throwable list.public FuzzyMethodContract.Builder exceptionSuperOf(java.lang.Class<?> type, int index)
type
- - exception type.index
- - the position in the throwable list.public FuzzyMethodContract.Builder exceptionMatches(AbstractFuzzyMatcher<java.lang.Class<?>> classMatcher, int index)
classMatcher
- - the class matcher that must match.index
- - the position in the throwable list.@Nonnull protected FuzzyMethodContract initialMember()
AbstractFuzzyMember.Builder
initialMember
in class AbstractFuzzyMember.Builder<FuzzyMethodContract>
public FuzzyMethodContract build()
AbstractFuzzyMember.Builder
Builders should call AbstractFuzzyMember.prepareBuild()
when constructing new objects.
build
in class AbstractFuzzyMember.Builder<FuzzyMethodContract>