Class FuzzyMethodContract
java.lang.Object
com.comphenix.protocol.reflect.fuzzy.AbstractFuzzyMatcher<T>
com.comphenix.protocol.reflect.fuzzy.AbstractFuzzyMember<MethodInfo>
com.comphenix.protocol.reflect.fuzzy.FuzzyMethodContract
- All Implemented Interfaces:
Comparable<AbstractFuzzyMatcher<MethodInfo>>
Represents a contract for matching methods or constructors.
- Author:
- Kristian
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classRepresents a builder for a fuzzy method contract. -
Field Summary
Fields inherited from class com.comphenix.protocol.reflect.fuzzy.AbstractFuzzyMember
declaringMatcher, modifiersBanned, modifiersRequired, nameRegex, sealed -
Method Summary
Modifier and TypeMethodDescriptionprotected intCalculate the round number indicating when this matcher should be applied.booleanList<com.comphenix.protocol.reflect.fuzzy.FuzzyMethodContract.ParameterClassMatcher>Retrieve an immutable list of every exception matcher for this method.Generate a view of this matcher as a key-value map.Retrieve the expected parameter count for this method.com.google.common.collect.ImmutableList<com.comphenix.protocol.reflect.fuzzy.FuzzyMethodContract.ParameterClassMatcher>Retrieve an immutable list of every parameter matcher for this method.Retrieve the class matcher for the return type.inthashCode()booleanisMatch(MethodInfo value, Object parent)Determine if the given value is a match.static FuzzyMethodContract.BuilderReturn a method contract builder.protected voidCalled before a builder is building a member and copying its state.Methods inherited from class com.comphenix.protocol.reflect.fuzzy.AbstractFuzzyMember
getDeclaringMatcher, getModifiersBanned, getModifiersRequired, getNameRegex, toStringMethods inherited from class com.comphenix.protocol.reflect.fuzzy.AbstractFuzzyMatcher
and, combineRounds, combineRounds, compareTo, getRoundNumber, inverted, or
-
Method Details
-
newBuilder
Return a method contract builder.- Returns:
- Method contract builder.
-
getReturnMatcher
Retrieve the class matcher for the return type.- Returns:
- Class matcher for the return type.
-
getParamMatchers
public com.google.common.collect.ImmutableList<com.comphenix.protocol.reflect.fuzzy.FuzzyMethodContract.ParameterClassMatcher> getParamMatchers()Retrieve an immutable list of every parameter matcher for this method.- Returns:
- Immutable list of every parameter matcher.
-
getExceptionMatchers
public List<com.comphenix.protocol.reflect.fuzzy.FuzzyMethodContract.ParameterClassMatcher> getExceptionMatchers()Retrieve an immutable list of every exception matcher for this method.- Returns:
- Immutable list of every exception matcher.
-
getParamCount
Retrieve the expected parameter count for this method.- Returns:
- Expected parameter count, or NULL if anyting goes.
-
prepareBuild
protected void prepareBuild()Description copied from class:AbstractFuzzyMemberCalled before a builder is building a member and copying its state.Use this to prepare any special values.
- Overrides:
prepareBuildin classAbstractFuzzyMember<MethodInfo>
-
isMatch
Description copied from class:AbstractFuzzyMatcherDetermine if the given value is a match.- Overrides:
isMatchin classAbstractFuzzyMember<MethodInfo>- Parameters:
value- - the value to match.parent- - the parent container, or NULL if this value is the root.- Returns:
- TRUE if it is a match, FALSE otherwise.
-
calculateRoundNumber
protected int calculateRoundNumber()Description copied from class:AbstractFuzzyMatcherCalculate the round number indicating when this matcher should be applied.Matchers with a lower round number are applied before matchers with a higher round number.
By convention, this round number should be negative, except for zero in the case of a matcher that accepts any value. A good implementation should return the inverted tree depth (class hierachy) of the least specified type used in the matching. Thus
Integerwill have a lower round number thanNumber.- Overrides:
calculateRoundNumberin classAbstractFuzzyMember<MethodInfo>- Returns:
- A number (positive or negative) that is used to order matchers.
-
getKeyValueView
Description copied from class:AbstractFuzzyMemberGenerate a view of this matcher as a key-value map.Used by
AbstractFuzzyMember.toString()to print a representation of this object.- Overrides:
getKeyValueViewin classAbstractFuzzyMember<MethodInfo>- Returns:
- A modifiable key-value view.
-
hashCode
public int hashCode()- Overrides:
hashCodein classAbstractFuzzyMember<MethodInfo>
-
equals
- Overrides:
equalsin classAbstractFuzzyMember<MethodInfo>
-