コマンド行 API を使用するには、CommandManagerBuilder から CommandManager を取得する必要があります。次のコード例に、CommandManager を取得する方法を示します。
public class CommandManagerBuilder {
/**
* Set the directory for the CLI installation directory
*/
public setHomeDirectory(File cliHomeDir){ ... }
/**
* Build a command manager with the properties set in this class
* @throws ConfigurationException incorrect properties
* specified for a valid CommandManager
*/
public CommandManager build() throws ConfigurationException {...}
}
構築メソッドの呼び出しは、負荷が大きい処理です。したがって、コマンドを実行する CommandManager は 1 つだけ作成するようにします。