Skip to content

Commit

Permalink
Version 1.8.4
Browse files Browse the repository at this point in the history
Update snakeyaml to 2.0
  • Loading branch information
Carleslc committed Apr 1, 2023
1 parent c26f98a commit 9ec2181
Show file tree
Hide file tree
Showing 389 changed files with 2,416 additions and 2,102 deletions.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ If you are using Maven you do not need to download the jar. Instead, add this re
<dependency>
<groupId>me.carleslc.Simple-YAML</groupId>
<artifactId>Simple-Yaml</artifactId>
<version>1.8.3</version>
<version>1.8.4</version>
</dependency>
```

Expand All @@ -65,7 +65,7 @@ If you are using Maven you do not need to download the jar. Instead, add this re
<dependency>
<groupId>me.carleslc.Simple-YAML</groupId>
<artifactId>Simple-Configuration</artifactId>
<version>1.8.3</version>
<version>1.8.4</version>
</dependency>
```

Expand All @@ -88,7 +88,7 @@ allprojects {

```gradle
dependencies {
implementation 'me.carleslc.Simple-YAML:Simple-Yaml:1.8.3'
implementation 'me.carleslc.Simple-YAML:Simple-Yaml:1.8.4'
}
```

Expand All @@ -99,7 +99,7 @@ dependencies {

```gradle
dependencies {
implementation 'me.carleslc.Simple-YAML:Simple-Configuration:1.8.3'
implementation 'me.carleslc.Simple-YAML:Simple-Configuration:1.8.4'
}
```

Expand Down
2 changes: 1 addition & 1 deletion Simple-Configuration/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<parent>
<artifactId>Simple-YAML-Parent</artifactId>
<groupId>me.carleslc.simpleyaml</groupId>
<version>1.8.3</version>
<version>1.8.4</version>
</parent>
<artifactId>Simple-Configuration</artifactId>
<groupId>me.carleslc</groupId>
Expand Down
6 changes: 3 additions & 3 deletions Simple-Yaml/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@
<parent>
<artifactId>Simple-YAML-Parent</artifactId>
<groupId>me.carleslc.simpleyaml</groupId>
<version>1.8.3</version>
<version>1.8.4</version>
</parent>
<artifactId>Simple-Yaml</artifactId>
<groupId>me.carleslc</groupId>
<name>Simple-Yaml</name>
<version>1.8.3</version>
<version>1.8.4</version>

<build>
<plugins>
Expand Down Expand Up @@ -44,7 +44,7 @@
<dependency>
<groupId>me.carleslc</groupId>
<artifactId>Simple-Configuration</artifactId>
<version>1.8.3</version>
<version>1.8.4</version>
</dependency>
<dependency>
<groupId>org.yaml</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import org.simpleyaml.utils.Validate;

import java.io.*;
import java.nio.file.Files;

/**
* An implementation of {@link Configuration} which saves the configuration in Yaml.
Expand Down Expand Up @@ -196,7 +197,7 @@ public static YamlConfiguration loadConfiguration(final File file) throws IOExce
@Override
public void load(final File file) throws FileNotFoundException, IOException, InvalidConfigurationException {
Validate.notNull(file, "File cannot be null");
load(() -> new FileInputStream(file));
load(() -> Files.newInputStream(file.toPath()));
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@
import org.simpleyaml.utils.SectionUtils;
import org.simpleyaml.utils.SupplierIO;
import org.yaml.snakeyaml.DumperOptions;
import org.yaml.snakeyaml.LoaderOptions;
import org.yaml.snakeyaml.error.YAMLException;
import org.yaml.snakeyaml.resolver.Resolver;

import java.io.File;
import java.io.IOException;
Expand All @@ -30,15 +32,26 @@
public class SimpleYamlImplementation extends SnakeYamlImplementation {

public SimpleYamlImplementation() {
super(new SnakeYamlRepresenter());
super();
}

public SimpleYamlImplementation(final LoaderOptions loaderOptions, final DumperOptions dumperOptions) {
super(loaderOptions, dumperOptions);
}

public SimpleYamlImplementation(final SnakeYamlRepresenter yamlRepresenter) {
super(yamlRepresenter);
}

public SimpleYamlImplementation(final SnakeYamlConstructor yamlConstructor, final SnakeYamlRepresenter yamlRepresenter, final DumperOptions yamlOptions) {
super(yamlConstructor, yamlRepresenter, yamlOptions);
public SimpleYamlImplementation(final SnakeYamlConstructor yamlConstructor,
final SnakeYamlRepresenter yamlRepresenter) {
super(yamlConstructor, yamlRepresenter);
}

public SimpleYamlImplementation(final SnakeYamlConstructor yamlConstructor,
final SnakeYamlRepresenter yamlRepresenter,
final Resolver resolver) {
super(yamlConstructor, yamlRepresenter, resolver);
}

@Override
Expand Down Expand Up @@ -149,8 +162,8 @@ public void configure(final YamlConfigurationOptions options) {
super.configure(options);

// Use custom comment processor
this.getLoaderOptions().setProcessComments(false);
this.getDumperOptions().setProcessComments(false);
this.loaderOptions.setProcessComments(false);
this.dumperOptions.setProcessComments(false);
}

}
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package org.simpleyaml.configuration.implementation.snakeyaml;

import org.simpleyaml.configuration.serialization.ConfigurationSerialization;
import org.yaml.snakeyaml.LoaderOptions;
import org.yaml.snakeyaml.constructor.SafeConstructor;
import org.yaml.snakeyaml.error.YAMLException;
import org.yaml.snakeyaml.nodes.*;
Expand All @@ -10,11 +11,13 @@

/**
* @author Bukkit
* @author Carleslc
* @see <a href="https://github.com/Bukkit/Bukkit/tree/master/src/main/java/org/bukkit/configuration/file/YamlConstructor.java">Bukkit Source</a>
*/
public class SnakeYamlConstructor extends SafeConstructor {

public SnakeYamlConstructor() {
public SnakeYamlConstructor(final LoaderOptions loaderOptions) {
super(loaderOptions);
this.yamlConstructors.put(Tag.MAP, new ConstructCustomObject());
}

Expand Down Expand Up @@ -66,7 +69,6 @@ public Object construct(final Node node) {
public void construct2ndStep(final Node node, final Object object) {
throw new YAMLException("Unexpected referential mapping structure. Node: " + node);
}

}

}
Original file line number Diff line number Diff line change
Expand Up @@ -25,38 +25,37 @@
*/
public class SnakeYamlImplementation extends YamlImplementationCommentable {

private SnakeYamlConstructor yamlConstructor;
private SnakeYamlRepresenter yamlRepresenter;
private DumperOptions dumperOptions;
private LoaderOptions loaderOptions;
private Resolver resolver;
private Yaml yaml;
protected final SnakeYamlConstructor yamlConstructor;
protected final SnakeYamlRepresenter yamlRepresenter;
protected final DumperOptions dumperOptions;
protected final LoaderOptions loaderOptions;
protected final Resolver resolver;
protected final Yaml yaml;

public SnakeYamlImplementation() {
this(new SnakeYamlRepresenter());
this(new LoaderOptions(), new DumperOptions());
}

public SnakeYamlImplementation(final SnakeYamlRepresenter yamlRepresenter) {
this(new SnakeYamlConstructor(), yamlRepresenter, new DumperOptions());
public SnakeYamlImplementation(final LoaderOptions loaderOptions, final DumperOptions dumperOptions) {
this(new SnakeYamlConstructor(loaderOptions), new SnakeYamlRepresenter(dumperOptions));
}

public SnakeYamlImplementation(final SnakeYamlConstructor yamlConstructor, final SnakeYamlRepresenter yamlRepresenter, final DumperOptions yamlOptions) {
this.setYaml(yamlConstructor, yamlRepresenter, yamlOptions);
public SnakeYamlImplementation(final SnakeYamlRepresenter yamlRepresenter) {
this(new SnakeYamlConstructor(new LoaderOptions()), yamlRepresenter);
}

protected final void setYaml(final SnakeYamlConstructor yamlConstructor, final SnakeYamlRepresenter yamlRepresenter, final DumperOptions yamlOptions) {
this.setYaml(yamlConstructor, yamlRepresenter, yamlOptions, new LoaderOptions(), new Resolver());
public SnakeYamlImplementation(final SnakeYamlConstructor yamlConstructor,
final SnakeYamlRepresenter yamlRepresenter) {
this(yamlConstructor, yamlRepresenter, new Resolver());
}

protected final void setYaml(final SnakeYamlConstructor yamlConstructor,
public SnakeYamlImplementation(final SnakeYamlConstructor yamlConstructor,
final SnakeYamlRepresenter yamlRepresenter,
final DumperOptions dumperOptions,
final LoaderOptions loaderOptions,
final Resolver resolver) {
this.yamlConstructor = yamlConstructor;
this.yamlRepresenter = yamlRepresenter;
this.dumperOptions = dumperOptions;
this.loaderOptions = loaderOptions;
this.loaderOptions = yamlConstructor.getLoadingConfig();
this.dumperOptions = yamlRepresenter.getDumperOptions();
this.resolver = resolver;
this.yaml = new Yaml(this.yamlConstructor, this.yamlRepresenter, this.dumperOptions, this.loaderOptions, this.resolver);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import org.simpleyaml.configuration.serialization.ConfigurationSerializable;
import org.simpleyaml.configuration.serialization.ConfigurationSerialization;
import org.yaml.snakeyaml.DumperOptions;
import org.yaml.snakeyaml.LoaderOptions;
import org.yaml.snakeyaml.nodes.Node;
import org.yaml.snakeyaml.nodes.Tag;
import org.yaml.snakeyaml.representer.Represent;
Expand All @@ -20,12 +21,20 @@
*/
public class SnakeYamlRepresenter extends Representer {

public SnakeYamlRepresenter() {
private final DumperOptions dumperOptions;

public SnakeYamlRepresenter(final DumperOptions dumperOptions) {
super(dumperOptions);
this.dumperOptions = dumperOptions;
this.multiRepresenters.put(ConfigurationSection.class, new RepresentConfigurationSection());
this.multiRepresenters.put(ConfigurationSerializable.class, new RepresentConfigurationSerializable());
this.multiRepresenters.put(QuoteValue.class, new RepresentQuoteValue());
}

protected final DumperOptions getDumperOptions() {
return this.dumperOptions;
}

private final class RepresentConfigurationSection extends RepresentMap {

@Override
Expand Down
6 changes: 3 additions & 3 deletions doc/Simple-Configuration/allclasses-frame.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
<!-- NewPage -->
<html lang="es">
<head>
<!-- Generated by javadoc (1.8.0_212) on Fri Nov 25 22:55:35 CET 2022 -->
<!-- Generated by javadoc (1.8.0_212) on Sat Apr 01 10:55:22 CEST 2023 -->
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>All Classes (Simple-Configuration 1.8.3 API)</title>
<meta name="date" content="2022-11-25">
<title>All Classes (Simple-Configuration 1.8.4 API)</title>
<meta name="date" content="2023-04-01">
<link rel="stylesheet" type="text/css" href="stylesheet.css" title="Style">
<script type="text/javascript" src="script.js"></script>
</head>
Expand Down
6 changes: 3 additions & 3 deletions doc/Simple-Configuration/allclasses-noframe.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
<!-- NewPage -->
<html lang="es">
<head>
<!-- Generated by javadoc (1.8.0_212) on Fri Nov 25 22:55:35 CET 2022 -->
<!-- Generated by javadoc (1.8.0_212) on Sat Apr 01 10:55:22 CEST 2023 -->
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>All Classes (Simple-Configuration 1.8.3 API)</title>
<meta name="date" content="2022-11-25">
<title>All Classes (Simple-Configuration 1.8.4 API)</title>
<meta name="date" content="2023-04-01">
<link rel="stylesheet" type="text/css" href="stylesheet.css" title="Style">
<script type="text/javascript" src="script.js"></script>
</head>
Expand Down
10 changes: 5 additions & 5 deletions doc/Simple-Configuration/constant-values.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,18 @@
<!-- NewPage -->
<html lang="es">
<head>
<!-- Generated by javadoc (1.8.0_212) on Fri Nov 25 22:55:34 CET 2022 -->
<!-- Generated by javadoc (1.8.0_212) on Sat Apr 01 10:55:22 CEST 2023 -->
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Constant Field Values (Simple-Configuration 1.8.3 API)</title>
<meta name="date" content="2022-11-25">
<title>Constant Field Values (Simple-Configuration 1.8.4 API)</title>
<meta name="date" content="2023-04-01">
<link rel="stylesheet" type="text/css" href="stylesheet.css" title="Style">
<script type="text/javascript" src="script.js"></script>
</head>
<body>
<script type="text/javascript"><!--
try {
if (location.href.indexOf('is-external=true') == -1) {
parent.document.title="Constant Field Values (Simple-Configuration 1.8.3 API)";
parent.document.title="Constant Field Values (Simple-Configuration 1.8.4 API)";
}
}
catch(err) {
Expand Down Expand Up @@ -178,6 +178,6 @@ <h2 title="org.simpleyaml">org.simpleyaml.*</h2>
<!-- -->
</a></div>
<!-- ======== END OF BOTTOM NAVBAR ======= -->
<p class="legalCopy"><small>Copyright &#169; 2022. All rights reserved.</small></p>
<p class="legalCopy"><small>Copyright &#169; 2023. All rights reserved.</small></p>
</body>
</html>
10 changes: 5 additions & 5 deletions doc/Simple-Configuration/deprecated-list.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,18 @@
<!-- NewPage -->
<html lang="es">
<head>
<!-- Generated by javadoc (1.8.0_212) on Fri Nov 25 22:55:34 CET 2022 -->
<!-- Generated by javadoc (1.8.0_212) on Sat Apr 01 10:55:22 CEST 2023 -->
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Deprecated List (Simple-Configuration 1.8.3 API)</title>
<meta name="date" content="2022-11-25">
<title>Deprecated List (Simple-Configuration 1.8.4 API)</title>
<meta name="date" content="2023-04-01">
<link rel="stylesheet" type="text/css" href="stylesheet.css" title="Style">
<script type="text/javascript" src="script.js"></script>
</head>
<body>
<script type="text/javascript"><!--
try {
if (location.href.indexOf('is-external=true') == -1) {
parent.document.title="Deprecated List (Simple-Configuration 1.8.3 API)";
parent.document.title="Deprecated List (Simple-Configuration 1.8.4 API)";
}
}
catch(err) {
Expand Down Expand Up @@ -121,6 +121,6 @@ <h2 title="Contents">Contents</h2>
<!-- -->
</a></div>
<!-- ======== END OF BOTTOM NAVBAR ======= -->
<p class="legalCopy"><small>Copyright &#169; 2022. All rights reserved.</small></p>
<p class="legalCopy"><small>Copyright &#169; 2023. All rights reserved.</small></p>
</body>
</html>
10 changes: 5 additions & 5 deletions doc/Simple-Configuration/help-doc.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,18 @@
<!-- NewPage -->
<html lang="es">
<head>
<!-- Generated by javadoc (1.8.0_212) on Fri Nov 25 22:55:35 CET 2022 -->
<!-- Generated by javadoc (1.8.0_212) on Sat Apr 01 10:55:22 CEST 2023 -->
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>API Help (Simple-Configuration 1.8.3 API)</title>
<meta name="date" content="2022-11-25">
<title>API Help (Simple-Configuration 1.8.4 API)</title>
<meta name="date" content="2023-04-01">
<link rel="stylesheet" type="text/css" href="stylesheet.css" title="Style">
<script type="text/javascript" src="script.js"></script>
</head>
<body>
<script type="text/javascript"><!--
try {
if (location.href.indexOf('is-external=true') == -1) {
parent.document.title="API Help (Simple-Configuration 1.8.3 API)";
parent.document.title="API Help (Simple-Configuration 1.8.4 API)";
}
}
catch(err) {
Expand Down Expand Up @@ -226,6 +226,6 @@ <h2>Constant Field Values</h2>
<!-- -->
</a></div>
<!-- ======== END OF BOTTOM NAVBAR ======= -->
<p class="legalCopy"><small>Copyright &#169; 2022. All rights reserved.</small></p>
<p class="legalCopy"><small>Copyright &#169; 2023. All rights reserved.</small></p>
</body>
</html>
Loading

0 comments on commit 9ec2181

Please sign in to comment.