Class Reference

  • All Implemented Interfaces:
    Binding

    public class Reference
    extends java.lang.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:
    Widget, Binding, LineReader.callWidget(String)
    • Constructor Summary

      Constructors 
      Constructor Description
      Reference​(java.lang.String name)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean equals​(java.lang.Object o)  
      int hashCode()  
      java.lang.String name()
      Returns the name of the referenced widget.
      java.lang.String toString()  
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • Reference

        public Reference​(java.lang.String name)
    • Method Detail

      • name

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

        public boolean equals​(java.lang.Object o)
        Overrides:
        equals in class java.lang.Object
      • hashCode

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

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object