public final class NameMatcher extends AbstractComponentMatcher
Component by name and (optionally) by type.| Constructor and Description |
|---|
NameMatcher(String name)
Creates a new
NameMatcher. |
NameMatcher(String name,
boolean requireShowing)
Creates a new
NameMatcher. |
NameMatcher(String name,
Class<? extends Component> type)
Creates a new
NameMatcher. |
NameMatcher(String name,
Class<? extends Component> type,
boolean requireShowing)
Creates a new
NameMatcher. |
| Modifier and Type | Method and Description |
|---|---|
boolean |
matches(Component c)
Indicates whether the name and visibility of the given AWT or Swing
Component matches the value specified
in this matcher. |
String |
toString() |
requireShowing, requireShowing, requireShowingMatches, resetpublic NameMatcher(@Nullable String name)
NameMatcher. The AWT or Swing Component to match does not have to be showing.name - the name of the Component we are looking for.NullPointerException - if the given name is null.IllegalArgumentException - if the given name is empty.public NameMatcher(@Nullable String name, boolean requireShowing)
NameMatcher.name - the name of the AWT or Swing Component we are looking for.requireShowing - indicates if the Component to match should be showing or not.NullPointerException - if the given name is null.IllegalArgumentException - if the given name is empty.public NameMatcher(@Nullable String name, @Nonnull Class<? extends Component> type)
NameMatcher. The AWT or Swing Component to match does not have to be showing.name - the name of the Component we are looking for.type - the type of the Component we are looking for.NullPointerException - if the given name is empty.IllegalArgumentException - if the given name is empty.NullPointerException - if the given type is null.public NameMatcher(@Nullable String name, @Nonnull Class<? extends Component> type, boolean requireShowing)
NameMatcher.name - the name of the AWT or Swing Component we are looking for.type - the type of the Component we are looking for.requireShowing - indicates if the Component to match should be showing or not.NullPointerException - if the given name is empty.IllegalArgumentException - if the given name is empty.NullPointerException - if the given type is null.@RunsInCurrentThread public boolean matches(@Nullable Component c)
Indicates whether the name and visibility of the given AWT or Swing Component matches the value specified
in this matcher.
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 name and visibility of the given Component matches the values specified in this
matcher, false otherwise.Copyright © 2014 AssertJ. All rights reserved.