Package com.martiansoftware.nailgun
Class AliasManager
java.lang.Object
com.martiansoftware.nailgun.AliasManager
An AliasManager is used to store and lookup command Aliases by name. See Alias for more details.
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionCreates a new AliasManager, populating it with default Aliases. -
Method Summary
Modifier and TypeMethodDescriptionvoid
Adds an Alias, replacing any previous entries with the same name.Returns the Alias with the specified nameReturns a Set that is a snapshot of the Alias list.void
loadFromProperties
(Properties properties) Loads Aliases from a java.util.Properties file located at the specified URL.void
removeAlias
(String aliasName) Removes the Alias with the specified name from the AliasManager.
-
Field Details
-
aliases
actual alias storage
-
-
Constructor Details
-
AliasManager
public AliasManager()Creates a new AliasManager, populating it with default Aliases.
-
-
Method Details
-
loadFromProperties
Loads Aliases from a java.util.Properties file located at the specified URL. The properties must be of the form:
each of which may have an optional[alias name]=[fully qualified classname]
For example, to create an alias called "[alias name].desc=[alias description]
myprog
" for classcom.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
Adds an Alias, replacing any previous entries with the same name.- Parameters:
alias
- the Alias to add
-
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
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
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.
-