T
- the type of Component
supported by this matcher.public abstract class GenericTypeMatcher<T extends Component> extends AbstractComponentMatcher
ComponentMatcher
that matches an AWT or Swing Component
by type and some custom search criteria. It
uses generics to improve type safety.Constructor and Description |
---|
GenericTypeMatcher(Class<T> supportedType)
Creates a new
GenericTypeMatcher . |
GenericTypeMatcher(Class<T> supportedType,
boolean requireShowing)
Creates a new
GenericTypeMatcher . |
Modifier and Type | Method and Description |
---|---|
protected abstract boolean |
isMatching(T component)
Verifies that the given AWT or Swing
Component matches some search criteria. |
boolean |
matches(Component c)
Verifies that the given AWT or Swing
Component : |
Class<T> |
supportedType() |
requireShowing, requireShowing, requireShowingMatches, reset
public GenericTypeMatcher(@Nonnull Class<T> supportedType)
GenericTypeMatcher
. The Component
to match does not have to be showing.supportedType
- the type supported by this matcher.NullPointerException
- if the given type is null
.public GenericTypeMatcher(@Nonnull Class<T> supportedType, boolean requireShowing)
GenericTypeMatcher
.supportedType
- the type supported by this matcher.requireShowing
- indicates if the Component
to match should be showing or not.NullPointerException
- if the given type is null
.@RunsInCurrentThread public final boolean matches(@Nullable Component c)
Verifies that the given AWT or Swing Component
:
ComponentMatcher
Note: This method is accessed in the current executing thread. Such thread may or may not be the event dispatch thread (EDT). Client code must call this method from the EDT.
c
- the Component
to verify.true
if the given Component
is an instance of the generic type of this matcher and matches
some search criteria. Otherwise, false
.@Nonnull public final Class<T> supportedType()
@RunsInCurrentThread protected abstract boolean isMatching(@Nonnull T component)
Verifies that the given AWT or Swing Component
matches some search criteria.
Note: This method is accessed in the current executing thread. Such thread may or may not be the event dispatch thread (EDT). Client code must call this method from the EDT.
component
- the Component
to verify.true
if the given Component
matches the defined search criteria; otherwise, false
.Copyright © 2014–2019 AssertJ. All rights reserved.