public final class ImmutableCommandMapping extends Object implements CommandMapping
Constructor and Description |
---|
ImmutableCommandMapping(CommandCallable callable,
String primary,
Collection<String> aliases)
Create a new instance.
|
ImmutableCommandMapping(CommandCallable callable,
String primary,
String... alias)
Create a new instance.
|
Modifier and Type | Method and Description |
---|---|
Set<String> |
getAllAliases()
Gets an immutable list of all aliases.
|
CommandCallable |
getCallable()
Gets the callable.
|
String |
getPrimaryAlias()
Gets the primary alias.
|
String |
toString() |
public ImmutableCommandMapping(CommandCallable callable, String primary, String... alias)
callable
- The command callableprimary
- The primary aliasalias
- A list of all aliasesIllegalArgumentException
- Thrown if aliases are duplicatedpublic ImmutableCommandMapping(CommandCallable callable, String primary, Collection<String> aliases)
callable
- The command callableprimary
- The primary aliasaliases
- A collection of all aliasesIllegalArgumentException
- Thrown if aliases are duplicatedpublic String getPrimaryAlias()
CommandMapping
getPrimaryAlias
in interface CommandMapping
public Set<String> getAllAliases()
CommandMapping
The returned list must contain at least one entry, of which one must
be the one returned by CommandMapping.getPrimaryAlias()
.
There may be several versions of the same alias with different casing, although generally implementations should ignore the casing of aliases.
getAllAliases
in interface CommandMapping
public CommandCallable getCallable()
CommandMapping
getCallable
in interface CommandMapping