Package org.syncany.cli
Class CommandFactory
- java.lang.Object
-
- org.syncany.cli.CommandFactory
-
public class CommandFactory extends java.lang.Object
The command factory can be used to instantiate a new command from a command name. TheCommandLineClientuses this class to create and run commands by mapping a command argument to a correspondingCommandclass.
-
-
Constructor Summary
Constructors Constructor Description CommandFactory()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static CommandgetInstance(java.lang.String commandName)Maps the given command name to a correspondingCommandclass and instantiates it.
-
-
-
Constructor Detail
-
CommandFactory
public CommandFactory()
-
-
Method Detail
-
getInstance
public static Command getInstance(java.lang.String commandName)
Maps the given command name to a correspondingCommandclass and instantiates it. The command name is camel-cased and mapped to a FQCN.Example: The command 'ls-remote' is mapped to the FQCN
org.syncany.cli.LsRemoteCommand.- Parameters:
commandName- Command name, e.g. ls-remote or init- Returns:
- Returns a
Commandinstance, ornullif the command name cannot be mapped to a class
-
-