Class FuzzyClassContract

java.lang.Object
com.comphenix.protocol.reflect.fuzzy.AbstractFuzzyMatcher<Class<?>>
com.comphenix.protocol.reflect.fuzzy.FuzzyClassContract
All Implemented Interfaces:
Comparable<AbstractFuzzyMatcher<Class<?>>>

public class FuzzyClassContract extends AbstractFuzzyMatcher<Class<?>>
Determine if a given class implements a given fuzzy (duck typed) contract.
Author:
Kristian
  • Method Details

    • newBuilder

      public static FuzzyClassContract.Builder newBuilder()
      Construct a new fuzzy class contract builder.
      Returns:
      A new builder.
    • getFieldContracts

      public com.google.common.collect.ImmutableList<AbstractFuzzyMatcher<Field>> getFieldContracts()
      Retrieve an immutable list of every field contract.

      This list is ordered in descending order of priority.

      Returns:
      List of every field contract.
    • getMethodContracts

      public com.google.common.collect.ImmutableList<AbstractFuzzyMatcher<MethodInfo>> getMethodContracts()
      Retrieve an immutable list of every method contract.

      This list is ordered in descending order of priority.

      Returns:
      List of every method contract.
    • getConstructorContracts

      public com.google.common.collect.ImmutableList<AbstractFuzzyMatcher<MethodInfo>> getConstructorContracts()
      Retrieve an immutable list of every constructor contract.

      This list is ordered in descending order of priority.

      Returns:
      List of every constructor contract.
    • getBaseclassContracts

      public com.google.common.collect.ImmutableList<AbstractFuzzyMatcher<Class<?>>> getBaseclassContracts()
      Retrieve an immutable list of every baseclass contract.

      This list is ordered in descending order of priority.

      Returns:
      List of every baseclass contract.
    • getInterfaceContracts

      public com.google.common.collect.ImmutableList<AbstractFuzzyMatcher<Class<?>>> getInterfaceContracts()
      Retrieve an immutable list of every interface contract.

      This list is ordered in descending order of priority.

      Returns:
      List of every interface contract.
    • calculateRoundNumber

      protected int calculateRoundNumber()
      Description copied from class: AbstractFuzzyMatcher
      Calculate 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 Integer will have a lower round number than Number.

      Specified by:
      calculateRoundNumber in class AbstractFuzzyMatcher<Class<?>>
      Returns:
      A number (positive or negative) that is used to order matchers.
    • isMatch

      public boolean isMatch(Class<?> value, Object parent)
      Description copied from class: AbstractFuzzyMatcher
      Determine if the given value is a match.
      Specified by:
      isMatch in class AbstractFuzzyMatcher<Class<?>>
      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.
    • toString

      public String toString()
      Overrides:
      toString in class Object