Package com.martiansoftware.nailgun
Class Alias
- java.lang.Object
-
- com.martiansoftware.nailgun.Alias
-
- All Implemented Interfaces:
java.lang.Comparable
public class Alias extends java.lang.Object implements java.lang.ComparableProvides a means to map memorable, short names to classes in order to make the issuing of commands more convenient. For example, an Alias can map the "mycommand" command to thecom.yourdomain.yourpackage.YourClassclass. Obviously, it's a lot easier to type "ng mycommand" than the fully qualified class name.
-
-
Field Summary
Fields Modifier and Type Field Description private java.lang.ClassclazzThe class providing amain()ornailMain()methodprivate java.lang.StringdescriptionThe alias description (may be used to provide help to users)private java.lang.StringnameThe alias name
-
Constructor Summary
Constructors Constructor Description Alias(java.lang.String name, java.lang.String description, java.lang.Class clazz)Creates a new Alias with the specified properties.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intcompareTo(java.lang.Object o)Compares Alias names - no other fields are compared.booleanequals(java.lang.Object o)Checks whether two Aliases have the same name.java.lang.ClassgetAliasedClass()Returns theClassobject providing a staticmain()ornailMain()method for this command.java.lang.StringgetDescription()Returns a description for the aliased commandjava.lang.StringgetName()Returns the name of the aliased commandinthashCode()
-
-
-
Constructor Detail
-
Alias
public Alias(java.lang.String name, java.lang.String description, java.lang.Class clazz)Creates a new Alias with the specified properties.- Parameters:
name- the alias name (short command)description- a description of the commandclazz- the class implementing the command
-
-
Method Detail
-
getAliasedClass
public java.lang.Class getAliasedClass()
Returns theClassobject providing a staticmain()ornailMain()method for this command.- Returns:
- the
Classobject providing a staticmain()ornailMain()method for this command.
-
getName
public java.lang.String getName()
Returns the name of the aliased command- Returns:
- the name of the aliased command
-
getDescription
public java.lang.String getDescription()
Returns a description for the aliased command- Returns:
- a description for the aliased command
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object- See Also:
Object.hashCode()
-
equals
public boolean equals(java.lang.Object o)
Checks whether two Aliases have the same name. Does not compare any other fields.- Overrides:
equalsin classjava.lang.Object- Parameters:
o- the other Alias to check- Returns:
- true if the specified Alias has the same name as this Alias.
-
compareTo
public int compareTo(java.lang.Object o)
Compares Alias names - no other fields are compared.- Specified by:
compareToin interfacejava.lang.Comparable- See Also:
Comparable.compareTo(Object)
-
-