Carleslc / Simple-YAML

This Java API provides an easy-to-use way to store data and provide configurations using the YAML format.
https://carleslc.me/Simple-YAML
GNU General Public License v3.0
132 stars 38 forks source link
comments config-management configuration configuration-file format java-api maven object save serialization snakeyaml yaml yaml-files yaml-format yml yml-files

Simple YAML

Latest version Build Status

This Java API provides an easy-to-use way to store data and provide configurations using the YAML format.

ko-fi

What is YAML?

YAML is a human-readable data-oriented serialization language.

Serialization is the process of translating data structures or object state into a format that can be stored and reconstructed later in the same or another computer environment.

You can learn more about YAML language here. Specifically, if you're interested to learn about the YAML syntax you can go to the Chapter 2 of the YAML specification.

Filename extensions: .yaml, .yml

What is Simple-YAML?

Simple-YAML is a library designed to create configuration files for your programs, tools and plugins.

The API is a port from Bukkit configuration wrapper with some features added, so you can use this library wherever you want without Bukkit dependency.

Simplicity is added with the YamlFile class, which has everything you need with easy use for creation, management and serialization of yaml files. It is an extension of YamlConfiguration.

Furthermore, you can optionally save your files with comments in mind. You can write your comments with a text editor as usual. In addition, not only you can preserve your comments but also with this API you can read and add comments programmatically to your configuration. Sounds good, right?

How to install

To use this API all you need is to download the latest Simple-Yaml.jar and put it as a dependency on your project.

Maven

If you are using Maven you do not need to download the jar. Instead, add this repository and dependency to your pom.xml:

<repositories>
    <repository>
      <id>jitpack.io</id>
      <url>https://jitpack.io</url>
    </repository>
</repositories>
Yaml + Configuration ```xml com.github.Carleslc.Simple-YAML Simple-Yaml 1.8.4 ``` You can also use `me.carleslc.Simple-YAML` as the _groupId_.
Configuration only ```xml com.github.Carleslc.Simple-YAML Simple-Configuration 1.8.4 ``` You can also use `me.carleslc.Simple-YAML` as the _groupId_.

Gradle

If you are using Gradle you do not need to download the jar. Instead, add this repository and dependency to your build file:

allprojects {
  repositories {
    maven { url 'https://jitpack.io' }
  }
}
Yaml + Configuration ```gradle dependencies { implementation 'com.github.Carleslc.Simple-YAML:Simple-Yaml:1.8.4' } ```
Configuration only ```gradle dependencies { implementation 'com.github.Carleslc.Simple-YAML:Simple-Configuration:1.8.4' } ```

How to use

The best way to learn how to use this API is through some examples.

You can find some examples to test here.

Find the example .yml files here.

For more information and methods see the Javadoc:

Dependencies

This API uses SnakeYAML underneath. It is already included in the latest Simple-Yaml.jar and with the maven or gradle dependencies.

Looking for other file type configurations?

Have a look to these repositories:

These projects are using the Simple-Configuration module, but they are not related directly with Simple-YAML.