Class FuzzyFieldContract

All Implemented Interfaces:
Comparable<AbstractFuzzyMatcher<Field>>

public class FuzzyFieldContract extends AbstractFuzzyMember<Field>
Represents a field matcher.
Author:
Kristian
  • Method Details

    • matchType

      public static FuzzyFieldContract matchType(AbstractFuzzyMatcher<Class<?>> matcher)
      Match a field by its type.
      Parameters:
      matcher - - the type to match.
      Returns:
      The field contract.
    • newBuilder

      public static FuzzyFieldContract.Builder newBuilder()
      Return a new fuzzy field contract builder.
      Returns:
      New fuzzy field contract builder.
    • getTypeMatcher

      public AbstractFuzzyMatcher<Class<?>> getTypeMatcher()
      Retrieve the class matcher that matches the type of a field.
      Returns:
      The class matcher.
    • isMatch

      public boolean isMatch(Field value, Object parent)
      Description copied from class: AbstractFuzzyMatcher
      Determine if the given value is a match.
      Overrides:
      isMatch in class AbstractFuzzyMember<Field>
      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: 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.

      Overrides:
      calculateRoundNumber in class AbstractFuzzyMember<Field>
      Returns:
      A number (positive or negative) that is used to order matchers.
    • getKeyValueView

      protected Map<String,​Object> getKeyValueView()
      Description copied from class: AbstractFuzzyMember
      Generate a view of this matcher as a key-value map.

      Used by AbstractFuzzyMember.toString() to print a representation of this object.

      Overrides:
      getKeyValueView in class AbstractFuzzyMember<Field>
      Returns:
      A modifiable key-value view.
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class AbstractFuzzyMember<Field>
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class AbstractFuzzyMember<Field>