Class AliasManager


  • public class AliasManager
    extends java.lang.Object
    An AliasManager is used to store and lookup command Aliases by name. See Alias for more details.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private java.util.Map aliases
      actual alias storage
    • Constructor Summary

      Constructors 
      Constructor Description
      AliasManager()
      Creates a new AliasManager, populating it with default Aliases.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void addAlias​(Alias alias)
      Adds an Alias, replacing any previous entries with the same name.
      Alias getAlias​(java.lang.String aliasName)
      Returns the Alias with the specified name
      java.util.Set getAliases()
      Returns a Set that is a snapshot of the Alias list.
      void loadFromProperties​(java.util.Properties properties)
      Loads Aliases from a java.util.Properties file located at the specified URL.
      void removeAlias​(java.lang.String aliasName)
      Removes the Alias with the specified name from the AliasManager.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • aliases

        private java.util.Map aliases
        actual alias storage
    • Constructor Detail

      • AliasManager

        public AliasManager()
        Creates a new AliasManager, populating it with default Aliases.
    • Method Detail

      • loadFromProperties

        public void loadFromProperties​(java.util.Properties properties)
        Loads Aliases from a java.util.Properties file located at the specified URL. The properties must be of the form:
        [alias name]=[fully qualified classname]
        each of which may have an optional
        [alias name].desc=[alias description]
        For example, to create an alias called " myprog" for class com.mydomain.myapp.MyProg, the following properties would be defined:
        myprog=com.mydomain.myapp.MyProg
        myprog.desc=Runs my program.
         
        Parameters:
        properties - the Properties to load.
      • addAlias

        public void addAlias​(Alias alias)
        Adds an Alias, replacing any previous entries with the same name.
        Parameters:
        alias - the Alias to add
      • getAliases

        public java.util.Set getAliases()
        Returns a Set that is a snapshot of the Alias list. Modifications to this Set will not impact the AliasManager in any way.
        Returns:
        a Set that is a snapshot of the Alias list.
      • removeAlias

        public void removeAlias​(java.lang.String aliasName)
        Removes the Alias with the specified name from the AliasManager. If no such Alias exists in this AliasManager, this method has no effect.
        Parameters:
        aliasName - the name of the Alias to remove
      • getAlias

        public Alias getAlias​(java.lang.String aliasName)
        Returns the Alias with the specified name
        Parameters:
        aliasName - the name of the Alias to retrieve
        Returns:
        the requested Alias, or null if no such Alias is defined in this AliasManager.