DialogMatcher (install4j API)
Description: declaration: package: com.install4j.api.test.ui, class: DialogMatcher

# Class DialogMatcher

java.lang.Object
com.install4j.api.test.ui.DialogMatcher

All Implemented Interfaces:
  `Serializable`

public final class DialogMatcher extends Object implements Serializable
Predicate over modal-dialog windows, used by `Session.dialog(DialogMatcher)` to identify the dialog the test wants to interact with. Serializable so it can be evaluated installer-side in subprocess mode without sending a raw `Predicate<Window>` across the wire.

Build a matcher by chaining factory and combinator methods:

    DialogMatcher.byClassName("com.example.MyDialog").andTitleRegex("Confirm.*")
    DialogMatcher.byTitle("Save changes?")
    DialogMatcher.dialogClass(JDialog.class).andContainingComponentNamed("yesButton")

A matcher only inspects window-side state: class, title (for `JDialog`/`JFrame`), and the names of components in the window's component tree. It does not run arbitrary code on the window; that would be wire-hostile.

See Also:
  - Serialized Form

- ## Method Summary

  Modifier and Type
  Method
  Description
  `DialogMatcher`
  `andClassName(String fqClassName)`
  Narrow by class name.
  `DialogMatcher`
  `andContainingComponentNamed(String swingName)`
  Narrow to dialogs that contain a child component with the given Swing name.
  `DialogMatcher`
  `andTitle(String exactTitle)`
  Narrow by exact title.
  `DialogMatcher`
  `andTitleRegex(String regex)`
  Narrow by title regex.
  `static DialogMatcher`
  `any()`
  A matcher that accepts any modal dialog window.
  `static DialogMatcher`
  `byClassName(String fqClassName)`
  Match by the window's runtime class name (fully qualified).
  `static DialogMatcher`
  `byTitle(String exactTitle)`
  Match by exact title (for `JDialog`/`JFrame`).
  `static DialogMatcher`
  `byTitleRegex(String regex)`
  Match by title regex.
  `static DialogMatcher`
  `dialogClass(Class<?> dialogClass)`
  Convenience for `byClassName(String)` from a `Class` literal.
  `boolean`
  `matches(Window window)`
  Whether the given currently-showing window matches every constraint on this matcher.
  `String`
  `toString()`

  ### Methods inherited from class Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- ## Method Details

  - ### any

    @NotNull public static DialogMatcher any()
    A matcher that accepts any modal dialog window.

  - ### byClassName

    @NotNull public static DialogMatcher byClassName(@NotNull String fqClassName)
    Match by the window's runtime class name (fully qualified).

  - ### dialogClass

    @NotNull public static DialogMatcher dialogClass(@NotNull Class<?> dialogClass)
    Convenience for `byClassName(String)` from a `Class` literal.

  - ### byTitle

    @NotNull public static DialogMatcher byTitle(@NotNull String exactTitle)
    Match by exact title (for `JDialog`/`JFrame`).

  - ### byTitleRegex

    @NotNull public static DialogMatcher byTitleRegex(@NotNull String regex)
    Match by title regex. The pattern is matched against the window's title.

  - ### andClassName

    @NotNull public DialogMatcher andClassName(@NotNull String fqClassName)
    Narrow by class name.

  - ### andTitle

    @NotNull public DialogMatcher andTitle(@NotNull String exactTitle)
    Narrow by exact title.

  - ### andTitleRegex

    @NotNull public DialogMatcher andTitleRegex(@NotNull String regex)
    Narrow by title regex.

  - ### andContainingComponentNamed

    @NotNull public DialogMatcher andContainingComponentNamed(@NotNull String swingName)
    Narrow to dialogs that contain a child component with the given Swing name.

  - ### matches

    public boolean matches(@NotNull Window window)
    Whether the given currently-showing window matches every constraint on this matcher. Returns `true` when there are no constraints set (i.e. `any()`).

  - ### toString

    public String toString()
    Overrides:
      `toString` in class `Object`