- Notifications
You must be signed in to change notification settings - Fork39
This Java API provides an easy-to-use way to store data and provide configurations using the YAML format.
License
Carleslc/Simple-YAML
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
This Java API provides an easy-to-use way to store data and provide configurations using the YAML format.
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 languagehere. Specifically, if you're interested to learn about the YAML syntax you can go to theChapter 2 of the YAML specification.
Filename extensions:.yaml
,.yml
Simple-YAML is a library designed to create configuration files for your programs, tools and plugins.
The API is a port fromBukkit configuration wrapper with some features added, so you can use this library wherever you want without Bukkit dependency.
Simplicity is added with theYamlFile
class, which has everything you need with easy use for creation, management and serialization of yaml files. It is an extension ofYamlConfiguration
.
Furthermore, you can optionally save your files withcomments 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?
To use this API all you need is to download thelatest Simple-Yaml.jar and put it as a dependency on your project.
If you are using Maven you do not need to download the jar. Instead, add this repository and dependency to yourpom.xml
:
<repositories> <repository> <id>jitpack.io</id> <url>https://jitpack.io</url> </repository></repositories>
Yaml + Configuration
<dependency> <groupId>com.github.Carleslc.Simple-YAML</groupId> <artifactId>Simple-Yaml</artifactId> <version>1.8.4</version></dependency>
You can also useme.carleslc.Simple-YAML
as thegroupId.
Configuration only
<dependency> <groupId>com.github.Carleslc.Simple-YAML</groupId> <artifactId>Simple-Configuration</artifactId> <version>1.8.4</version></dependency>
You can also useme.carleslc.Simple-YAML
as thegroupId.
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
dependencies { implementation'com.github.Carleslc.Simple-YAML:Simple-Yaml:1.8.4'}
Configuration only
dependencies { implementation'com.github.Carleslc.Simple-YAML:Simple-Configuration:1.8.4'}
The best way to learn how to use this API is through some examples.
You can find some examples to testhere.
YamlExample
: An example to create YAML files, save or delete values and move through the file configuration.YamlCommentsExample
: An example to load and save YAML files keeping comments and also how to read and add comments programmatically.YamlCommentsFormatExample
: An example to format header and comments with custom prefixes, suffixes and blank lines.YamlEncodingExample
: A minimal example to check your encoding with Unicode characters.YamlSerializationExample
: An example for saving complex objects using serialization.Person
: An example of class for complex objects used in the previous file. Here you can see how to serialize and deserialize objects.
Find the example.yml
fileshere.
For more information and methods see theJavadoc:
This API usesSnakeYAML underneath. It is already included in thelatest Simple-Yaml.jar and with the maven or gradle dependencies.
Have a look to these repositories:
These projects are using the Simple-Configuration module, but they are not related directly with Simple-YAML.
About
This Java API provides an easy-to-use way to store data and provide configurations using the YAML format.