From 124158ac9946dee630dee40f3f094736469b3938 Mon Sep 17 00:00:00 2001 From: Fulminazzo Date: Thu, 15 Feb 2024 04:16:13 +0100 Subject: [PATCH] YAMLParser now supports YAML lists not parsed by the parser itself. This means that list of type ```yaml list: - test: "Hello" - test: "Hi" ``` will be parsed as a list of (ConfigurationSection)[src/main/java/it/fulminazzo/yamlparser/configuration/ConfigurationSection]. Totally reworked classes separation to respect packaging conventions. Reworked FileConfiguration#addParsers method. Renamed `it.fulminazzo.yamlparser.configurations` package to `it.fulminazzo.yamlparser.configuration`. Made FileConfiguration and ConfigurationSection final. Added support for escaped dot characters: now it will be able to use `\.` in paths to allow for dotted strings to be parsed. Added support for BigDecimal notation when getting Number types. Added `unquote` method to remove quoted strings when saving or loading. Now IConfiguration extends Serializable. Fixed dotted test error. Updated README.md Updated FulmiCollection --- .../yamlparser/configuration/IConfiguration.java | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/src/main/java/it/fulminazzo/yamlparser/configuration/IConfiguration.java b/src/main/java/it/fulminazzo/yamlparser/configuration/IConfiguration.java index 8501368..e6a76b6 100644 --- a/src/main/java/it/fulminazzo/yamlparser/configuration/IConfiguration.java +++ b/src/main/java/it/fulminazzo/yamlparser/configuration/IConfiguration.java @@ -993,6 +993,13 @@ default String getCurrentPath() { return path.toString(); } + /** + * Throw exception. + * + * @param path the path + * @param object the object + * @param e the e + */ default void throwException(String path, Object object, Throwable e) { if (e instanceof RuntimeException || e instanceof InvocationTargetException) e = e.getCause(); path = path == null ? "null" : path; @@ -1127,7 +1134,13 @@ else if (v instanceof List) { return treeMap; } - static String unquote(String string) { + /** + * Removes any quote from the given string. + * + * @param string the string + * @return the string + */ + static String unquote(@Nullable String string) { if (string == null) return null; while (string.length() > 2 && string.startsWith("\"") && string.endsWith("\"")) string = string.substring(1, string.length() - 1);