Class FuzzyMethodContract.Builder
java.lang.Object
com.comphenix.protocol.reflect.fuzzy.AbstractFuzzyMember.Builder<FuzzyMethodContract>
com.comphenix.protocol.reflect.fuzzy.FuzzyMethodContract.Builder
- Enclosing class:
FuzzyMethodContract
public static final class FuzzyMethodContract.Builder
extends AbstractFuzzyMember.Builder<FuzzyMethodContract>
Represents a builder for a fuzzy method contract.
-
Field Summary
Fields inherited from class com.comphenix.protocol.reflect.fuzzy.AbstractFuzzyMember.Builder
member -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbanModifier(int modifier) Add a given bit-field of modifers that will skip or ignore members.build()Build a new instance of this type.declaringClassDerivedOf(Class<?> declaringClass) Require that a member is defined by this exact class, or any super class.declaringClassExactType(Class<?> declaringClass) Require that a member is defined by this exact class.declaringClassMatching(AbstractFuzzyMatcher<Class<?>> classMatcher) Require that a member is defined by a class that matches the given matcher.declaringClassSuperOf(Class<?> declaringClass) Require that a member is defined by this exact class, or any super class.exceptionExactType(Class<?> type) Add a throwable exception that must match the given type exactly.exceptionExactType(Class<?> type, int index) Add a throwable exception that must match the given type exactly and index.exceptionMatches(AbstractFuzzyMatcher<Class<?>> classMatcher) Add a throwable exception that must match the given matcher,exceptionMatches(AbstractFuzzyMatcher<Class<?>> classMatcher, int index) Add a throwable exception that must match the given matcher and index.exceptionSuperOf(Class<?> type) Add a throwable exception that must match the given type or be derived.exceptionSuperOf(Class<?> type, int index) Add a throwable exception that must match the given type or be derived and index.protected FuzzyMethodContractConstruct a new instance of the current type.Set the exact name of the member we are matching.Set the regular expresson that matches a members name.Set the regular expression pattern that matches a members name.parameterCount(int expectedCount) Set the expected number of parameters in the matching method.parameterDerivedOf(Class<?> type) Add a new required parameter whose type must be a derived class of the given class.parameterDerivedOf(Class<?> type, int index) Add a new required parameter whose type must be a derived class of the given class.parameterExactArray(Class<?>... types) Add a new required parameters by type and order for any matching method.parameterExactType(Class<?> type) Add a new required parameter by type for any matching method.parameterExactType(Class<?> type, int index) Add a new required parameter by type and position for any matching method.parameterMatches(AbstractFuzzyMatcher<Class<?>> classMatcher) Add a new required parameter whose type must match the given class matcher.parameterMatches(AbstractFuzzyMatcher<Class<?>> classMatcher, int index) Add a new required parameter whose type must match the given class matcher and index.parameterSuperOf(Class<?> type) Add a new required parameter whose type must be a superclass of the given type.parameterSuperOf(Class<?> type, int index) Add a new required parameter whose type must be a superclass of the given type.requireModifier(int modifier) Add a given bit-field of required modifiers for every matching member.Require that every matching member is public.returnDerivedOf(Class<?> type) Set the expected super class of the return type for every matching method.returnTypeExact(Class<?> type) Set the return type of a matching method exactly.returnTypeMatches(AbstractFuzzyMatcher<Class<?>> classMatcher) Set a matcher that must match the return type of a matching method.Require a void method.
-
Constructor Details
-
Builder
public Builder()
-
-
Method Details
-
requireModifier
Description copied from class:AbstractFuzzyMember.BuilderAdd a given bit-field of required modifiers for every matching member.- Overrides:
requireModifierin classAbstractFuzzyMember.Builder<FuzzyMethodContract>- Parameters:
modifier- - bit-field of modifiers that are required.- Returns:
- This builder, for chaining.
-
requirePublic
Description copied from class:AbstractFuzzyMember.BuilderRequire that every matching member is public.- Overrides:
requirePublicin classAbstractFuzzyMember.Builder<FuzzyMethodContract>- Returns:
- This builder, for chaining.
-
banModifier
Description copied from class:AbstractFuzzyMember.BuilderAdd a given bit-field of modifers that will skip or ignore members.- Overrides:
banModifierin classAbstractFuzzyMember.Builder<FuzzyMethodContract>- Parameters:
modifier- - bit-field of modifiers to skip or ignore.- Returns:
- This builder, for chaining.
-
nameRegex
Description copied from class:AbstractFuzzyMember.BuilderSet the regular expresson that matches a members name.- Overrides:
nameRegexin classAbstractFuzzyMember.Builder<FuzzyMethodContract>- Parameters:
regex- - new regular expression of valid names.- Returns:
- This builder, for chaining.
-
nameRegex
Description copied from class:AbstractFuzzyMember.BuilderSet the regular expression pattern that matches a members name.- Overrides:
nameRegexin classAbstractFuzzyMember.Builder<FuzzyMethodContract>- Parameters:
pattern- - regular expression pattern for a valid name.- Returns:
- This builder, for chaining.
-
nameExact
Description copied from class:AbstractFuzzyMember.BuilderSet the exact name of the member we are matching.This will overwrite the regular expression rule.
- Overrides:
nameExactin classAbstractFuzzyMember.Builder<FuzzyMethodContract>- Parameters:
name- - exact name.- Returns:
- This builder, for chaining.
-
declaringClassExactType
Description copied from class:AbstractFuzzyMember.BuilderRequire that a member is defined by this exact class.- Overrides:
declaringClassExactTypein classAbstractFuzzyMember.Builder<FuzzyMethodContract>- Parameters:
declaringClass- - the declaring class of any matching member.- Returns:
- This builder, for chaining.
-
declaringClassSuperOf
Description copied from class:AbstractFuzzyMember.BuilderRequire that a member is defined by this exact class, or any super class.- Overrides:
declaringClassSuperOfin classAbstractFuzzyMember.Builder<FuzzyMethodContract>- Parameters:
declaringClass- - the declaring class.- Returns:
- This builder, for chaining.
-
declaringClassDerivedOf
Description copied from class:AbstractFuzzyMember.BuilderRequire that a member is defined by this exact class, or any super class.- Overrides:
declaringClassDerivedOfin classAbstractFuzzyMember.Builder<FuzzyMethodContract>- Parameters:
declaringClass- - the declaring class.- Returns:
- This builder, for chaining.
-
declaringClassMatching
public FuzzyMethodContract.Builder declaringClassMatching(AbstractFuzzyMatcher<Class<?>> classMatcher) Description copied from class:AbstractFuzzyMember.BuilderRequire that a member is defined by a class that matches the given matcher.- Overrides:
declaringClassMatchingin classAbstractFuzzyMember.Builder<FuzzyMethodContract>- Parameters:
classMatcher- - class matcher.- Returns:
- This builder, for chaining.
-
parameterExactType
Add a new required parameter by type for any matching method.- Parameters:
type- - the exact type this parameter must match.- Returns:
- This builder, for chaining.
-
parameterSuperOf
Add a new required parameter whose type must be a superclass of the given type.If a method parameter is of type Number, then any derived class here (Integer, Long, etc.) will match it.
- Parameters:
type- - a type or less derived type of the matching parameter.- Returns:
- This builder, for chaining.
-
parameterDerivedOf
Add a new required parameter whose type must be a derived class of the given class.If the method parameter has the type Integer, then the class Number here will match it.
- Parameters:
type- - a type or more derived type of the matching parameter.- Returns:
- This builder, for chaining.
-
parameterMatches
Add a new required parameter whose type must match the given class matcher.- Parameters:
classMatcher- - the class matcher.- Returns:
- This builder, for chaining.
-
parameterExactType
Add a new required parameter by type and position for any matching method.- Parameters:
type- - the exact type this parameter must match.index- - the expected position in the parameter list.- Returns:
- This builder, for chaining.
-
parameterExactArray
Add a new required parameters by type and order for any matching method.- Parameters:
types- - the types of every parameters in order.- Returns:
- This builder, for chaining.
-
parameterSuperOf
Add a new required parameter whose type must be a superclass of the given type.If a parameter is of type Number, any derived class (Integer, Long, etc.) will match it.
- Parameters:
type- - a type or derived type of the matching parameter.index- - the expected position in the parameter list.- Returns:
- This builder, for chaining.
-
parameterDerivedOf
Add a new required parameter whose type must be a derived class of the given class.If the method parameter has the type Integer, then the class Number here will match it.
- Parameters:
type- - a type or more derived type of the matching parameter.index- - the expected position in the parameter list.- Returns:
- This builder, for chaining.
-
parameterMatches
public FuzzyMethodContract.Builder parameterMatches(AbstractFuzzyMatcher<Class<?>> classMatcher, int index) Add a new required parameter whose type must match the given class matcher and index.- Parameters:
classMatcher- - the class matcher.index- - the expected position in the parameter list.- Returns:
- This builder, for chaining.
-
parameterCount
Set the expected number of parameters in the matching method.- Parameters:
expectedCount- - the number of parameters to expect.- Returns:
- This builder, for chaining.
-
returnTypeVoid
Require a void method.- Returns:
- This builder, for chaining.
-
returnTypeExact
Set the return type of a matching method exactly.- Parameters:
type- - the exact return type.- Returns:
- This builder, for chaining.
-
returnDerivedOf
Set the expected super class of the return type for every matching method.- Parameters:
type- - the return type, or a super class of it.- Returns:
- This builder, for chaining.
-
returnTypeMatches
Set a matcher that must match the return type of a matching method.- Parameters:
classMatcher- - the exact return type.- Returns:
- This builder, for chaining.
-
exceptionExactType
Add a throwable exception that must match the given type exactly.- Parameters:
type- - exception type.- Returns:
- This builder, for chaining.
-
exceptionSuperOf
Add a throwable exception that must match the given type or be derived.- Parameters:
type- - exception type.- Returns:
- This builder, for chaining.
-
exceptionMatches
Add a throwable exception that must match the given matcher,- Parameters:
classMatcher- - the class matcher that must match.- Returns:
- This builder, for chaining.
-
exceptionExactType
Add a throwable exception that must match the given type exactly and index.- Parameters:
type- - exception type.index- - the position in the throwable list.- Returns:
- This builder, for chaining.
-
exceptionSuperOf
Add a throwable exception that must match the given type or be derived and index.- Parameters:
type- - exception type.index- - the position in the throwable list.- Returns:
- This builder, for chaining.
-
exceptionMatches
public FuzzyMethodContract.Builder exceptionMatches(AbstractFuzzyMatcher<Class<?>> classMatcher, int index) Add a throwable exception that must match the given matcher and index.- Parameters:
classMatcher- - the class matcher that must match.index- - the position in the throwable list.- Returns:
- This builder, for chaining.
-
initialMember
Description copied from class:AbstractFuzzyMember.BuilderConstruct a new instance of the current type.- Specified by:
initialMemberin classAbstractFuzzyMember.Builder<FuzzyMethodContract>- Returns:
- New instance.
-
build
Description copied from class:AbstractFuzzyMember.BuilderBuild a new instance of this type.Builders should call
AbstractFuzzyMember.prepareBuild()when constructing new objects.- Specified by:
buildin classAbstractFuzzyMember.Builder<FuzzyMethodContract>- Returns:
- New instance of this type.
-