Class Reference

java.lang.Object
org.jline.reader.Reference
All Implemented Interfaces:
Binding

public class Reference extends Object implements Binding
A reference to a Widget by name.

The Reference class is a type of Binding that refers to a widget by its name rather than directly holding the widget implementation. When a key sequence bound to a Reference is pressed, the LineReader will look up the referenced widget by name and execute it.

This indirection allows for more flexible key bindings, as it enables binding keys to widgets that might be defined or redefined after the key binding is established. It also allows multiple key sequences to reference the same widget without duplicating the widget implementation.

References are particularly useful in configuration files where widgets are referred to by name rather than by direct object references.

See Also:
  • Constructor Details

    • Reference

      public Reference(String name)
  • Method Details

    • name

      public String name()
      Returns the name of the referenced widget.
      Returns:
      the widget name
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object