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. TheCommandLineClient
uses this class to create and run commands by mapping a command argument to a correspondingCommand
class.
-
-
Constructor Summary
Constructors Constructor Description CommandFactory()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static Command
getInstance(java.lang.String commandName)
Maps the given command name to a correspondingCommand
class 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 correspondingCommand
class 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
Command
instance, ornull
if the command name cannot be mapped to a class
-
-