From 12fee6cbbfc0d8503633dd6870d3ee55d59de2db Mon Sep 17 00:00:00 2001 From: "snorkell-ai[bot]" <146478655+snorkell-ai[bot]@users.noreply.github.com> Date: Mon, 18 Dec 2023 20:53:08 +0000 Subject: [PATCH] [Snorkell.ai]: Documentation for ThemeLoader.java --- .../calculator/theme/ThemeLoader.java | 35 +++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/src/main/java/com/houarizegai/calculator/theme/ThemeLoader.java b/src/main/java/com/houarizegai/calculator/theme/ThemeLoader.java index e01f81e..3ba56fa 100644 --- a/src/main/java/com/houarizegai/calculator/theme/ThemeLoader.java +++ b/src/main/java/com/houarizegai/calculator/theme/ThemeLoader.java @@ -16,6 +16,17 @@ private ThemeLoader() { throw new AssertionError("Constructor is not allowed"); } + /** + * Loads themes from the application.yaml file and returns them as a map. + * + * @return A map containing the loaded themes. + * @throws IOException if an I/O error occurs while reading the application.yaml file. + * + * Example: + *
{@code
+     * Map themes = loadThemes();
+     * }
+ */ public static Map loadThemes() { ObjectMapper mapper = new ObjectMapper(new YAMLFactory()); @@ -28,6 +39,18 @@ public static Map loadThemes() { } } + /** + * Loads themes from the specified YAML file and returns a map of theme names to Theme objects. + * + * @param theme the name of the theme to load + * @return a map of theme names to Theme objects + * @throws IOException if an error occurs while reading the YAML file + * + * Example: + *
{@code
+     * Map themes = loadThemes("default");
+     * }
+ */ public static Map loadThemes(String theme) { ObjectMapper mapper = new ObjectMapper(new YAMLFactory()); mapper.findAndRegisterModules(); @@ -39,6 +62,18 @@ public static Map loadThemes(String theme) { } } + /** + * Loads themes from the specified YAML file and returns a map of theme names to Theme objects. + * + * @param theme the theme to load + * @param dType the type of the theme + * @return a map of theme names to Theme objects + * @throws IOException if an I/O error occurs while reading the YAML file + * + * Example: + * + * Map themes = loadThemes("default", "dark"); + */ public static Map loadThemes(String theme, String dType) { ObjectMapper mapper = new ObjectMapper(new YAMLFactory()); mapper.findAndRegisterModules();