Class Alias

java.lang.Object
org.aesh.readline.alias.Alias
All Implemented Interfaces:
Comparable

public class Alias extends Object implements Comparable
Alias value object
Author:
Ståle W. Pedersen
  • Constructor Summary

    Constructors
    Constructor
    Description
    Alias(String name, String value)
    Creates a new Alias with the specified name and value.
  • Method Summary

    Modifier and Type
    Method
    Description
    int
    Compares this alias to another alias by name for ordering.
    boolean
    Compares this alias to another object for equality.
    Returns the name of this alias.
    Returns the value of this alias.
    int
    Returns a hash code value for this alias.
    Returns a string representation of this alias in the format "name='value'".

    Methods inherited from class Object

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

    • Alias

      public Alias(String name, String value)
      Creates a new Alias with the specified name and value.
      Parameters:
      name - the alias name used to invoke the alias
      value - the command or text that the alias expands to
  • Method Details

    • getName

      public String getName()
      Returns the name of this alias.
      Returns:
      the alias name
    • getValue

      public String getValue()
      Returns the value of this alias.
      Returns:
      the command or text that the alias expands to
    • equals

      public boolean equals(Object o)
      Compares this alias to another object for equality. Two aliases are considered equal if they have the same name.
      Overrides:
      equals in class Object
      Parameters:
      o - the object to compare with
      Returns:
      true if the object is an Alias with the same name, false otherwise
    • hashCode

      public int hashCode()
      Returns a hash code value for this alias.
      Overrides:
      hashCode in class Object
      Returns:
      a constant hash code value
    • toString

      public String toString()
      Returns a string representation of this alias in the format "name='value'".
      Overrides:
      toString in class Object
      Returns:
      a string representation of the alias
    • compareTo

      public int compareTo(Object o)
      Compares this alias to another alias by name for ordering.
      Specified by:
      compareTo in interface Comparable
      Parameters:
      o - the alias to compare with
      Returns:
      a negative integer, zero, or a positive integer as this alias name is less than, equal to, or greater than the specified alias name