Package com.bobocode.bring.core.utils
Class Banner
java.lang.Object
com.bobocode.bring.core.utils.Banner
The
Banner class provides functionality for printing a banner to the console,
either from a predefined string or custom banner by reading from a file.
Configuration options:
BRING_BANNER_KEY: Key for enabling/disabling the main banner. Default is "ON".BRING_BANNER_FILE_KEY: Key for specifying the path to the banner file. Default is "resource/banner.txt".
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumAn enumeration of possible values for configuring the Banner. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringThe banner.txt file.static final StringKey for specifying the path to the banner file.static final StringDefault value for specifying the path to the banner file.static final StringKey for enabling/disabling the main banner.static final StringDefault value for enabling/disabling the main banner.static final StringThe default banner content.private static final StringMessage displayed when the resource folder is not found. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate static Banner.ModeGets the configured banner mode (ON or OFF).private static PathgetPath()Gets the path to the banner file, resolving it based on the classpath.private static booleanChecks if the banner should be read from a file based on the configuration.static voidPrints the banner to the console based on the configured mode and file settings.
-
Field Details
-
BRING_BANNER_KEY
Key for enabling/disabling the main banner. Default is "ON".- See Also:
-
BRING_BANNER_VALUE
Default value for enabling/disabling the main banner.- See Also:
-
BRING_BANNER_FILE_KEY
Key for specifying the path to the banner file. Default is "resources/banner.txt".- See Also:
-
BRING_BANNER_FILE_VALUE
Default value for specifying the path to the banner file.- See Also:
-
BANNER_TXT
The banner.txt file.- See Also:
-
FILE_NOT_FOUND_MESSAGE
Message displayed when the resource folder is not found.- See Also:
-
DEFAULT_BANNER_CONTENT
The default banner content.- See Also:
-
-
Constructor Details
-
Banner
public Banner()
-
-
Method Details
-
printBanner
public static void printBanner()Prints the banner to the console based on the configured mode and file settings. -
getBannerMode
Gets the configured banner mode (ON or OFF).- Returns:
- The configured banner mode.
-
hasToReadFromFile
private static boolean hasToReadFromFile()Checks if the banner should be read from a file based on the configuration.- Returns:
trueif reading from a file is configured,falseotherwise.
-
getPath
Gets the path to the banner file, resolving it based on the classpath.- Returns:
- The path to the banner file.
-