java.lang.Object
org.refcodes.archetype.CliHelper.Builder
- Direct Known Subclasses:
AppHelper.Builder
- Enclosing class:
- CliHelper
Builder to build
CliHelper
.-
Field Summary
Modifier and TypeFieldDescriptionprotected String[]
protected org.refcodes.cli.ArgsSyntax
protected org.refcodes.textual.Font
protected char[]
protected org.refcodes.runtime.ConfigLocator
protected String
protected String
protected String
protected Collection<org.refcodes.cli.Example>
protected String
protected org.refcodes.logger.RuntimeLogger
protected String
protected String
protected Class<?>
protected org.refcodes.cli.SyntaxNotation
protected String
protected boolean
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionaddExampleUsage
(String aDescription, org.refcodes.cli.Operand<?>... aOperands) Builder method adding an application'sExample
element.addExampleUsage
(org.refcodes.cli.Example aExamples) Builder method adding an application'sExample
element.build()
Creates a newCliHelper
using the configured properties.Builder method providing the application's command line arguments.Builder method providing the application's command line arguments.withArgsSyntax
(org.refcodes.cli.ArgsSyntax aArgsSyntax) Builder method providing the application's command line syntax.withBannerFont
(org.refcodes.textual.Font aBannerFont) Builder method providing the application's banner font.withBannerFontPalette
(char[] aBannerFontPalette) Builder method providing the application's banner ASCII palette.withBannerFontPalette
(org.refcodes.data.AsciiColorPalette aBannerFontPalette) Builder method providing the application's banner ASCII palette.withConfigLocator
(org.refcodes.runtime.ConfigLocator aConfigLocator) Builder method providing theConfigLocator
when doing a lookup of the configuration file.withCopyrightNote
(String aCopyrightNote) Builder method providing the application's copyright.withDefaultConfig
(String aDefaultConfig) Builder method providing the application's configuration file path.withDescription
(String aDescription) Builder method providing the application's description property.withExamples
(Collection<org.refcodes.cli.Example> aExamples) Builder method providing the application'sExample
elements.withExamples
(org.refcodes.cli.Example[] aExamples) Builder method providing the application'sExample
elements.withLicenseNote
(String aLicenseNote) Builder method providing the application's license.withLogger
(org.refcodes.logger.RuntimeLogger aLogger) Builder method providing the application'sRuntimeLogger
.Builder method providing the application's name property.withPasswordPrompt
(String aPasswordPrompt) Builder method providing the application's default password prompt.withResourceLocator
(Class<?> aResourceLocator) Builder method providing theClass
when doing a lookup of a (module specific) resource.withShutDownHook
(Consumer<Integer> aShutDownHook) Builder method providing an (optional) shutdown hook: When provided, then this hook is called instead ofSystem.exit(int)
(it is up to the shutdown hook to terminate the application in the end).withSyntaxNotation
(org.refcodes.cli.SyntaxNotation aSyntaxNotation) Builder method setting theSyntaxNotation
.Builder method providing the application's description property.withVerboseFallback
(boolean aVerboseFallback) Builder method providing the application's verbose fallback property.
-
Field Details
-
syntaxNotation
protected org.refcodes.cli.SyntaxNotation syntaxNotation -
name
-
passwordPrompt
-
args
-
argsSyntax
protected org.refcodes.cli.ArgsSyntax argsSyntax -
bannerFont
protected org.refcodes.textual.Font bannerFont -
bannerFontPalette
protected char[] bannerFontPalette -
defaultConfig
-
copyrightNote
-
description
-
exampleUsages
-
licenseNote
-
logger
protected org.refcodes.logger.RuntimeLogger logger -
title
-
verboseFallback
protected boolean verboseFallback -
configLocator
protected org.refcodes.runtime.ConfigLocator configLocator -
resourceLocator
-
shutDownHook
-
-
Constructor Details
-
Builder
protected Builder()
-
-
Method Details
-
addExampleUsage
Builder method adding an application'sExample
element.- Parameters:
aExamples
- The application'sExample
element to be added.- Returns:
- This
CliHelper.Builder
as of the builder pattern.
-
addExampleUsage
public CliHelper.Builder addExampleUsage(String aDescription, org.refcodes.cli.Operand<?>... aOperands) Builder method adding an application'sExample
element.- Parameters:
aDescription
- The example's description.aOperands
- The command line arguments required by the example.- Returns:
- This
CliHelper.Builder
as of the builder pattern.
-
withName
Builder method providing the application's name property.- Parameters:
aAppName
- The application's name.- Returns:
- This
CliHelper.Builder
as of the builder pattern.
-
withPasswordPrompt
Builder method providing the application's default password prompt.- Parameters:
aPasswordPrompt
- The application's default password prompt.- Returns:
- This
CliHelper.Builder
as of the builder pattern.
-
withConfigLocator
Builder method providing theConfigLocator
when doing a lookup of the configuration file.- Parameters:
aConfigLocator
- The application'sConfigLocator
.- Returns:
- This
CliHelper.Builder
as of the builder pattern.
-
withResourceLocator
Builder method providing theClass
when doing a lookup of a (module specific) resource.- Parameters:
aResourceLocator
- The application'sClass
which to use when loading resources (of the according module) by invokingClass.getResourceAsStream(String)
.- Returns:
- This
CliHelper.Builder
as of the builder pattern.
-
withSyntaxNotation
Builder method setting theSyntaxNotation
.- Parameters:
aSyntaxNotation
- TheSyntaxNotation
to use.- Returns:
- This
CliHelper.Builder
as of the builder pattern.
-
withArgs
Builder method providing the application's command line arguments.- Parameters:
aArgs
- The application's command line arguments.- Returns:
- This
CliHelper.Builder
as of the builder pattern.
-
withArgs
Builder method providing the application's command line arguments.- Parameters:
aArgs
- The application's command line arguments.- Returns:
- This
CliHelper.Builder
as of the builder pattern.
-
withArgsSyntax
Builder method providing the application's command line syntax.- Parameters:
aArgsSyntax
- The application's command line syntax.- Returns:
- This
CliHelper.Builder
as of the builder pattern.
-
withBannerFont
Builder method providing the application's banner font.- Parameters:
aBannerFont
- The application's banner font.- Returns:
- This
CliHelper.Builder
as of the builder pattern.
-
withBannerFontPalette
public CliHelper.Builder withBannerFontPalette(org.refcodes.data.AsciiColorPalette aBannerFontPalette) Builder method providing the application's banner ASCII palette.- Parameters:
aBannerFontPalette
- The application's banner ASCII palette.- Returns:
- This
CliHelper.Builder
as of the builder pattern.
-
withBannerFontPalette
Builder method providing the application's banner ASCII palette.- Parameters:
aBannerFontPalette
- The application's banner ASCII palette.- Returns:
- This
CliHelper.Builder
as of the builder pattern.
-
withDefaultConfig
Builder method providing the application's configuration file path.- Parameters:
aDefaultConfig
- The application's configuration file path.- Returns:
- This
CliHelper.Builder
as of the builder pattern.
-
withCopyrightNote
Builder method providing the application's copyright.- Parameters:
aCopyrightNote
- The application's copyright.- Returns:
- This
CliHelper.Builder
as of the builder pattern.
-
withDescription
Builder method providing the application's description property.- Parameters:
aDescription
- The application's description.- Returns:
- This
CliHelper.Builder
as of the builder pattern.
-
withExamples
Builder method providing the application'sExample
elements.- Parameters:
aExamples
- The application'sExample
elements to use.- Returns:
- This
CliHelper.Builder
as of the builder pattern.
-
withExamples
Builder method providing the application'sExample
elements.- Parameters:
aExamples
- The application'sExample
.- Returns:
- This
CliHelper.Builder
as of the builder pattern.
-
withLicenseNote
Builder method providing the application's license.- Parameters:
aLicenseNote
- The application's license.- Returns:
- This
CliHelper.Builder
as of the builder pattern.
-
withLogger
Builder method providing the application'sRuntimeLogger
.- Parameters:
aLogger
- The application'sRuntimeLogger
.- Returns:
- This
CliHelper.Builder
as of the builder pattern.
-
withShutDownHook
Builder method providing an (optional) shutdown hook: When provided, then this hook is called instead ofSystem.exit(int)
(it is up to the shutdown hook to terminate the application in the end).- Parameters:
aShutDownHook
- The (optional) shutdown hook.- Returns:
- This
CliHelper.Builder
as of the builder pattern.
-
withTitle
Builder method providing the application's description property.- Parameters:
aTitle
- The application's title (used when printing the banner).- Returns:
- This
CliHelper.Builder
as of the builder pattern.
-
withVerboseFallback
Builder method providing the application's verbose fallback property. In case noVerboseFlag
neitherQuietFlag
parsers are present and no "verbose" neither "quiet" value are found in the properties, then this value is used as a fallback, either to be "more verbose" (true) or "more quiet" (false).- Parameters:
aVerboseFallback
- The fallback verbose mode if the verbose mode cannot be determined otherwise.- Returns:
- This
CliHelper.Builder
as of the builder pattern.
-
build
Creates a newCliHelper
using the configured properties.- Returns:
- The accordingly configured
CliHelper
.
-