Class ConsoleEngine.WidgetCreator

java.lang.Object
org.jline.console.ConsoleEngine.WidgetCreator
All Implemented Interfaces:
org.jline.reader.Binding, org.jline.reader.Widget
Enclosing interface:
ConsoleEngine

public static class ConsoleEngine.WidgetCreator extends Object implements org.jline.reader.Widget
Class for creating widgets from console functions.

A WidgetCreator creates a widget that executes a function defined in the console. This allows console functions to be bound to key sequences and used as widgets.

  • Constructor Details

    • WidgetCreator

      public WidgetCreator(ConsoleEngine consoleEngine, String function)
      Creates a new widget creator for the specified function.
      Parameters:
      consoleEngine - the console engine that will execute the function
      function - the name of the function to execute
  • Method Details

    • apply

      public boolean apply()
      Executes the function when the widget is applied.
      Specified by:
      apply in interface org.jline.reader.Widget
      Returns:
      true if the function was executed successfully, false otherwise
    • toString

      public String toString()
      Returns the name of the function.
      Overrides:
      toString in class Object
      Returns:
      the name of the function