Class GenericTypeMatcher<T extends Component>

java.lang.Object
org.fest.swing.core.AbstractComponentMatcher
org.fest.swing.core.GenericTypeMatcher<T>
Type Parameters:
T - the type of Component supported by this matcher.
All Implemented Interfaces:
ComponentMatcher, ResettableComponentMatcher
Direct Known Subclasses:
NamedComponentMatcherTemplate

public abstract class GenericTypeMatcher<T extends Component> extends AbstractComponentMatcher
Understands a ComponentMatcher that matches a Component by type and some custom search criteria.
  • Field Details

  • Constructor Details

    • GenericTypeMatcher

      public GenericTypeMatcher(Class<T> supportedType)
      Creates a new GenericTypeMatcher. The component to match does not have to be showing.
      Parameters:
      supportedType - the type supported by this matcher.
      Throws:
      NullPointerException - if the given type is null.
    • GenericTypeMatcher

      public GenericTypeMatcher(Class<T> supportedType, boolean requireShowing)
      Creates a new GenericTypeMatcher.
      Parameters:
      supportedType - the type supported by this matcher.
      requireShowing - indicates if the component to match should be showing or not.
      Throws:
      NullPointerException - if the given type is null.
  • Method Details

    • matches

      @RunsInCurrentThread public final boolean matches(Component c)
      Verifies that the given Component:
      1. Is an instance of the generic type specified in this ComponentMatcher
      2. Matches some search criteria

      Note: This method is not executed in the event dispatch thread (EDT.) Clients are responsible for invoking this method in the EDT.

      Parameters:
      c - the Component to verify.
      Returns:
      true if the given Component is an instance of the generic type of this matcher and matches some search criteria. Otherwise, false.
    • supportedType

      public final Class<T> supportedType()
      Returns the supported type of this matcher.
      Returns:
      the supported type of this matcher.
    • isMatching

      @RunsInCurrentThread protected abstract boolean isMatching(T component)
      Verifies that the given component matches some search criteria.

      Note: Implementations of this method should not use the event dispatch thread (EDT.) Clients are responsible for invoking this method in the EDT.

      Parameters:
      component - the Component to verify.
      Returns:
      true if the given component matches the defined search criteria; otherwise, false.