Skip to content

Commit

Permalink
YAMLParser now supports YAML lists not parsed by the parser itself.
Browse files Browse the repository at this point in the history
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.
Updated FulmiCollection
Updated README.md
  • Loading branch information
Fulminazzo committed Feb 6, 2024
1 parent 51e2e1e commit 03efc0a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ plugins {
}

group = 'it.fulminazzo'
version = '1.5.4'
version = '1.5.5'

repositories {
mavenCentral()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.math.BigDecimal;
import java.util.*;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
Expand Down Expand Up @@ -189,6 +190,8 @@ default <O> void set(@NotNull String path, @Nullable O o) {
object = object.toString();
if (tmp.equals(String.class)) return (T) object;
Method method = tmp.getMethod("valueOf", object.getClass());
if (Number.class.isAssignableFrom(tmp) && object.toString().contains("E"))
object = new BigDecimal(object.toString()).toBigInteger().toString();
if (tmp.equals(Integer.class)) {
String str = object.toString();
final Matcher matcher = Pattern.compile(".*(\\.0+)").matcher(str);
Expand Down

0 comments on commit 03efc0a

Please sign in to comment.