Module info.picocli.shell.jline3
Package picocli.shell.jline3
Class PicocliCommands.PicocliCommandsFactory
- java.lang.Object
-
- picocli.shell.jline3.PicocliCommands.PicocliCommandsFactory
-
- All Implemented Interfaces:
CommandLine.IFactory
- Enclosing class:
- PicocliCommands
public static class PicocliCommands.PicocliCommandsFactory extends Object implements CommandLine.IFactory
Command factory that is necessary for applications that want the use theClearScreensubcommand. It can be chained with other factories.WARNING: If the application uses the
ClearScreensubcommand, construct theCommandLinewith aPicocliCommandsFactory, and set theTerminalon that factory. Applications need to call thesetTerminalmethod with aTerminal; this will be passed to theClearScreensubcommand. For example:PicocliCommandsFactory factory = new PicocliCommandsFactory(); CommandLine cmd = new CommandLine(new MyApp(), factory); // create terminal factory.setTerminal(terminal);
Other factories can be chained by passing them in to the constructor like this:MyCustomFactory customFactory = createCustomFactory(); // your application custom factory PicocliCommandsFactory factory = new PicocliCommandsFactory(customFactory); // chain the factories
- Since:
- 4.6
-
-
Constructor Summary
Constructors Constructor Description PicocliCommandsFactory()PicocliCommandsFactory(CommandLine.IFactory nextFactory)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description <K> Kcreate(Class<K> clazz)Returns an instance of the specified class.voidsetTerminal(org.jline.terminal.Terminal terminal)
-
-
-
Constructor Detail
-
PicocliCommandsFactory
public PicocliCommandsFactory()
-
PicocliCommandsFactory
public PicocliCommandsFactory(CommandLine.IFactory nextFactory)
-
-
Method Detail
-
create
public <K> K create(Class<K> clazz) throws Exception
Description copied from interface:CommandLine.IFactoryReturns an instance of the specified class.- Specified by:
createin interfaceCommandLine.IFactory- Type Parameters:
K- the type of the object to return- Parameters:
clazz- the class of the object to return- Returns:
- the instance
- Throws:
Exception- an exception detailing what went wrong when creating or obtaining the instance
-
setTerminal
public void setTerminal(org.jline.terminal.Terminal terminal)
-
-