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
Modifier and TypeClassDescriptionstatic enum
An enumeration of possible values for configuring the Banner. -
Field Summary
Modifier and TypeFieldDescriptionstatic final String
The banner.txt file.static final String
Key for specifying the path to the banner file.static final String
Default value for specifying the path to the banner file.static final String
Key for enabling/disabling the main banner.static final String
Default value for enabling/disabling the main banner.static final String
The default banner content.private static final String
Message displayed when the resource folder is not found. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprivate static Banner.Mode
Gets the configured banner mode (ON or OFF).private static Path
getPath()
Gets the path to the banner file, resolving it based on the classpath.private static boolean
Checks if the banner should be read from a file based on the configuration.static void
Prints 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:
true
if reading from a file is configured,false
otherwise.
-
getPath
Gets the path to the banner file, resolving it based on the classpath.- Returns:
- The path to the banner file.
-