Ethylene is a open-source, lightweight, general-purpose compatibility layer standing between the developer and the chaotic world of configuration file formats.

Overview

Ethylene

Ethylene is a open-source, lightweight, general-purpose compatibility layer standing between the developer and the chaotic world of configuration file formats. The purpose of this library is simple: decouple any specific configuration format (TOML, JSON, YML, ...) from the code that actually uses it. Ideally, with minimal work by the developer, you should even be able to change or mix different formats without needing to modify lots of code.

Get Ethylene

Ethylene binaries are available from a publicly hosted Cloudsmith repository.

Latest Versions
  • ethylene-core
    Latest version of 'ethylene-core' @ Cloudsmith
  • ethylene-json
    Latest version of 'ethylene-json' @ Cloudsmith
  • ethylene-toml
    Latest version of 'ethylene-toml' @ Cloudsmith

For Gradle, add the Cloudsmith URL to the repositories block like this:

repositories {
    maven {
        url 'https://dl.cloudsmith.io/public/steank-f1g/ethylene/maven/'
    }
}

Then, in your dependencies section:

dependencies {
    implementation 'com.github.steanky:ethylene-core:1.0.0'
}

For Maven, you'd add the repository like this:

<repositories>
  <repository>
    <id>steank-f1g-ethylene</id>
    <url>https://dl.cloudsmith.io/public/steank-f1g/ethylene/maven/</url>
  </repository>
</repositories>

And the dependency like this:

<dependency>
  <groupId>com.github.steanky</groupId>
  <artifactId>ethylene-core</artifactId>
  <version>1.0.0</version>
</dependency>

Note that in most cases you'll actually want to depend on a bunch of different Ethylene modules, such as ethylene-json or ethylene-toml, as without at least one of these you won't actually be able to read or write configuration data.

Examples

Using Ethylene is simple. To read some configuration data from a source (let's say a file, /tmp/config.json), you can do something like this:

ConfigNode node = ConfigBridges.read(new File("/tmp/config.json"), new JsonCodec());

The node object will contain the data stored in the file we just read from. Ethylene knew how to interpret that data because the codec we supplied, JsonCodec, is designed for that purpose.

Now, let's assume that our file contains the following json:

{
  "string" : "This is a string!",
  "number" : 100,
  "developer" : {
    "name" : "Steanky",
    "repositories" : [ "Ethylene", "Polymer", "RegularCommands" ]
  }
}

In order to access the value associated with string, we can do the following:

String string = node.get("string").asString();

string, as expected, will be equal to "This is a string!"

Here are some of the other ways you can access data:

int number = node.get("number").asNumber().intValue();

//nested objects, like developer, are themselves ConfigNode objects
ConfigNode developer = node.get("developer").asNode();

//name is "Steanky"
String name = developer.get("name");

//support for lists
ConfigList list = developer.get("repositories").asList();

//repository is "Polymer"
String repository = list.get(1).asString();

//you can also directly access nested elements using getElement and providing a "path" of keys
//name is "Steanky"
String name = node.get("developer", "name").asString();

//ConfigNode and ConfigList objects are fully integrated into Java's type system:
List<ConfigElement> exampleList = list;
Map<String, ConfigElement> exampleMap = developer;

//they're also fully mutable:
list.remove(0); //removes "Ethylene"
developer.put("age", 69); //adds an age field
developer.clear(); //removes all values from developer

For additional examples, check out the example-project module.

Build Ethylene

Building Ethylene is simple! Just clone this repository and run gradlew build in the root directory.

Ethylene uses a few custom Gradle plugins to simplify build logic. These can be found in the buildSrc/src/main/groovy folder. If you're creating addons, like support for a specific configuration format, take a look at the build.gradle file for an existing module, and use the same structure.

Contributing

See CONTRIBUTING.md for more information on making contributions.

Hosting

Hosted By: Cloudsmith

Package repository hosting is graciously provided by Cloudsmith. Cloudsmith is the only fully hosted, cloud-native, universal package management solution, that enables your organization to create, store and share packages in any format, to any place, with total confidence.

Comments
  • 0.15.0

    0.15.0

    Description
    0.15.0 update. Contains:

    • API for creating immutable copies, type-preserving copies, and immutable views of ConfigContainers ✔️
    • Some API improvements for the object mapper (WIP)
      • Less redundant way of declaring custom signatures ✔️
      • Builder method for scalar signatures ✔️
      • Ability to process enums ✔️

    Issue Reference
    Reference related issue(s) here (if applicable)

    opened by Steanky 0
  • Dev

    Dev

    Description
    0.13.0 update Added object mapper for ConfigElement -> POJO and vice-versa Improve readme Some optimizations made to various components Added a ConfigSource capable of reading/writing entire directory and file trees Immutable ConfigElements

    Issue Reference
    N/A

    opened by Steanky 0
  • 0.12.3

    0.12.3

    Description
    0.12.3 PR Add ConfigPrimitive#nullPrimitive Properly utilize ConfigProcessor#CONFIG_LIST and ConfigProcessor#CONFIG_NODE in ConfigProcessor default methods Add ConfigProcessor#optionalProcessor() for (de)serializing optional data Issue Reference
    N/A

    opened by Steanky 0
  • bump version, add ConfigNode, ConfigList, and ConfigContainer processors

    bump version, add ConfigNode, ConfigList, and ConfigContainer processors

    Description
    0.12.2 update Add ConfigProcessor.CONFIG_NODE, ConfigProcessor.CONFIG_LIST, and ConfigProcessor.CONFIG_CONTAINER to more easily process nodes, lists, and containers

    Issue Reference
    N/A

    opened by Steanky 0
  • Dev

    Dev

    Description
    0.7.0 update Bugfix for HJSON, additional unit tests, using a new parser for TOML because of a bug with the previous one

    Issue Reference
    N/A

    opened by Steanky 0
  • Dev -> Main

    Dev -> Main

    Description
    Added get[x]OrThrow methods to ConfigElement, ConfigElementUtils no longer provides getOrDefault methods (these are now internal and only used by ConfigElement).

    Issue Reference
    N/A

    opened by Steanky 0
  • Dev

    Dev

    Description
    New API added for loading ConfigElement objects and converting them to data objects, as well as the concept of "default" data. ConfigBridges uses Path objects instead of File objects for reading/write to the filesystem. Removed FileConfigNode as it has absolutely no reason to exist (and would not work in case of some codecs like YAML that allow top-level data types besides maps).

    Issue Reference
    N/A

    opened by Steanky 0
Releases(v0.17.0)
  • v0.17.0(Dec 21, 2022)

  • v0.16.2(Dec 3, 2022)

  • v0.16.0(Nov 12, 2022)

  • v0.15.3(Nov 12, 2022)

  • v0.15.2(Nov 12, 2022)

  • v0.15.1(Oct 16, 2022)

  • v0.15.0(Oct 16, 2022)

    What's Changed

    • 0.15.0 by @Steanky in https://github.com/Steanky/Ethylene/pull/35

    Full Changelog: https://github.com/Steanky/Ethylene/compare/v0.14.0...v0.15.0

    Source code(tar.gz)
    Source code(zip)
  • v0.14.0(Oct 12, 2022)

    What's Changed

    • Dev by @Steanky in https://github.com/Steanky/Ethylene/pull/34

    Full Changelog: https://github.com/Steanky/Ethylene/compare/v0.13.0...v0.14.0

    Source code(tar.gz)
    Source code(zip)
  • v0.13.0(Oct 11, 2022)

    What's Changed

    • Merge changes from master by @Steanky in https://github.com/Steanky/Ethylene/pull/21
    • optimize imports + version bump + added some utility methods to Confi… by @Steanky in https://github.com/Steanky/Ethylene/pull/22
    • Object mapper by @Steanky in https://github.com/Steanky/Ethylene/pull/29
    • Dev by @Steanky in https://github.com/Steanky/Ethylene/pull/33

    Full Changelog: https://github.com/Steanky/Ethylene/compare/v0.12.4...v0.13.0

    Source code(tar.gz)
    Source code(zip)
  • v0.12.4(Sep 4, 2022)

    What's Changed

    • 0.12.4 by @Steanky in https://github.com/Steanky/Ethylene/pull/32

    Full Changelog: https://github.com/Steanky/Ethylene/compare/v0.12.3...v0.12.4

    Source code(tar.gz)
    Source code(zip)
  • v0.12.3(Sep 3, 2022)

    What's Changed

    • 0.12.3 by @Steanky in https://github.com/Steanky/Ethylene/pull/31

    Full Changelog: https://github.com/Steanky/Ethylene/compare/v0.12.2...v0.12.3

    Source code(tar.gz)
    Source code(zip)
  • v0.12.2(Sep 3, 2022)

    What's Changed

    • bump version, add ConfigNode, ConfigList, and ConfigContainer processors by @Steanky in https://github.com/Steanky/Ethylene/pull/30

    Full Changelog: https://github.com/Steanky/Ethylene/compare/v0.12.1...v0.12.2

    Source code(tar.gz)
    Source code(zip)
  • v0.12.1(Aug 28, 2022)

    What's Changed

    • bump patch version, add ConfigList#of by @Steanky in https://github.com/Steanky/Ethylene/pull/28

    Full Changelog: https://github.com/Steanky/Ethylene/compare/v0.12.0...v0.12.1

    Source code(tar.gz)
    Source code(zip)
  • v0.12.0(Aug 21, 2022)

    What's Changed

    • 0.12.0 by @Steanky in https://github.com/Steanky/Ethylene/pull/27

    Full Changelog: https://github.com/Steanky/Ethylene/compare/v0.11.3...v0.12.0

    Source code(tar.gz)
    Source code(zip)
  • v0.11.3(Aug 18, 2022)

    What's Changed

    • 1.0.0 merge by @Steanky in https://github.com/Steanky/Ethylene/pull/1
    • 1.0.0 merge part 2 by @Steanky in https://github.com/Steanky/Ethylene/pull/2
    • remove redundant mavenCentral() repository statement on ethylene-json… by @Steanky in https://github.com/Steanky/Ethylene/pull/3
    • Merge main into dev by @Steanky in https://github.com/Steanky/Ethylene/pull/4
    • Merge pull request #4 from Steanky/main by @Steanky in https://github.com/Steanky/Ethylene/pull/5
    • Dev by @Steanky in https://github.com/Steanky/Ethylene/pull/6
    • README changes by @Steanky in https://github.com/Steanky/Ethylene/pull/7
    • Dev by @Steanky in https://github.com/Steanky/Ethylene/pull/8
    • Dev by @Steanky in https://github.com/Steanky/Ethylene/pull/9
    • Dev by @Steanky in https://github.com/Steanky/Ethylene/pull/10
    • Merge README changes by @Steanky in https://github.com/Steanky/Ethylene/pull/11
    • Dev merge (0.3.0) by @Steanky in https://github.com/Steanky/Ethylene/pull/12
    • Dev by @Steanky in https://github.com/Steanky/Ethylene/pull/13
    • fix jdoc by @Steanky in https://github.com/Steanky/Ethylene/pull/14
    • added API for managing groups of ConfigLoader instances by @Steanky in https://github.com/Steanky/Ethylene/pull/15
    • Dev by @Steanky in https://github.com/Steanky/Ethylene/pull/16
    • Dev -> Main by @Steanky in https://github.com/Steanky/Ethylene/pull/17
    • 0.5.1 update, including some fixes and an expanded API for ConfigBridges by @Steanky in https://github.com/Steanky/Ethylene/pull/18
    • 0.5.2 update, including more constructors for LinkedConfigNode and Ar… by @Steanky in https://github.com/Steanky/Ethylene/pull/19
    • Dev by @Steanky in https://github.com/Steanky/Ethylene/pull/20
    • optimize imports + version bump + added some utility methods to Confi… by @Steanky in https://github.com/Steanky/Ethylene/pull/23
    • Dev by @Steanky in https://github.com/Steanky/Ethylene/pull/24
    • Dev by @Steanky in https://github.com/Steanky/Ethylene/pull/25
    • add map processor helper function + bump version by @Steanky in https://github.com/Steanky/Ethylene/pull/26

    Full Changelog: https://github.com/Steanky/Ethylene/commits/v0.11.3

    Source code(tar.gz)
    Source code(zip)
Owner
Steank
Hi, I'm Steank. I'm a computer science student who mainly develops Minecraft server plugins in his free time. I also have some experience with C# and WPF.
Steank
Apollo is a reliable configuration management system suitable for microservice configuration management scenarios.

English | 中文 Apollo - A reliable configuration management system Apollo is a reliable configuration management system. It can centrally manage the con

Apollo 27.6k Jan 5, 2023
🕊️ The world's most advanced open source instant messaging engine for 100K~10M concurrent users https://turms-im.github.io/docs

简体中文 What is Turms Turms is the most advanced open-source instant messaging engine for 100K~10M concurrent users in the world. Please refer to Turms D

null 1.2k Dec 27, 2022
Drifty is an open-source interactive File Downloader system built with java. It is currently available in CLI mode and has the GUI version under active development.

Drifty Drifty is an open-source interactive File Downloader system built using Java. It takes the link to the file, the directory where it needs to be

Saptarshi Sarkar 60 Dec 24, 2022
VirtualApp - VirtualApp With Compatibility Of Android 10/11/12

VirtualApp 工程 全新体验,多种优化 特性 高性能、高稳定性、修复构建错误等等 本内核仅供开发人员参考,请勿构建成品并发表到任何地方 仅供自行测试使用 如有修改建议欢迎提交PR 本项目为商业版开源,修改可看commit 开源网站太多使用旧版泄露版商业版或者垃圾版本冒充商业版 不仅不完善,还

图样图森破 478 Sep 8, 2022
Babelfish Compass: compatibility assessment tool for Babelfish for PostgreSQL

Babelfish Compass Babelfish Compass is a compatibility assessment tool for Babelfish for PostgreSQL. With Babelfish Compass, users can quickly analyze

null 76 Dec 29, 2022
Transfer Service app to transfer money between source and destination account

transferserviceapp Transfer Service app to transfer money between source and destination account H2 Console available at : http://localhost:8080/h2-co

null 1 Oct 21, 2021
Two Spring-boot applications registering themselves to an spring-boot-admin-server application as separate clients for the purpose of monitoring and managing the clients

Spring-boot-admin implementation with 1 Server and 2 clients Creating a Server application to monitor and manage Spring boot applications (clients) un

null 6 Dec 6, 2022
Implementation of Greedy Particle Swarm Optimization, HSGA and Hybrid(GA+PSO) for the purpose of Task Scheduling in cloud computing environment using CloudSim

Implementation of Greedy Particle Swarm Optimization, HSGA and Hybrid(GA+PSO) for the purpose of Task Scheduling in cloud computing environment using CloudSim

Yash Jain 5 Dec 18, 2022
CIRCUS - a Java and Spring Boot application for creating rooms with the purpose of watching YouTube videos together, similar to Watch2Gether

CIRCUS Video rooms application built using Apache Kafka, Java, Spring Boot, Spring Security and PostgreSQL About CIRCUS is a Java and Spring Boot appl

Castanho Correia 1 Jun 5, 2022
Rivr is a lightweight open-source dialogue engine enabling Java developers to easily create enterprise-grade VoiceXML applications.

Overview Rivr is a lightweight open-source dialogue engine enabling Java developers to easily create enterprise-grade VoiceXML applications. Read our

Nu Echo Inc. 57 Jun 27, 2022
Nrich is a Java library developed at CROZ whose purpose is to make development of applications on JVM a little easier.

nrich Nrich is a Java library developed at CROZ whose purpose is to make development of applications on JVM a little easier. It contains modules that

CROZ 44 Nov 12, 2022
An advanced, multi-purpose Discord bot

TechnoBot An advanced, multi-purpose bot for Discord Explore this project » Visit Wiki · Report Bug · Request Feature Table of Contents About The Proj

Thomas 13 Dec 28, 2022
InterfaceMaker is a modern plugin to handle and customize join items, hotbars and menus with a developer and administrator friendly API.

Interface Maker InterfaceMaker is a modern plugin to handle and customize join items, hotbars and menus with a developer friendly API. Features Simple

2LStudios - Minecraft 10 Nov 27, 2022
N-Layer Architecture human resource management system project with Java.

HRMS Project Backend N-Layer Architecture human resource management system project with Java. Report Bug · Request Feature About The Project Built Wit

Ahmet Çetinkaya 78 Dec 26, 2022
Model Layer Implementation for a J2EE Pull MVC WebApp

Modality is a lightweight but hightly configurable Java ORM, with a companion set of tools docs home modality-core doc modality-webapp doc velocity-to

Claude Brisson 11 Jan 3, 2023
OBKV Table Client is Java Library that can be used to access table data from OceanBase storage layer.

OBKV Table Client OBKV Table Client is Java Library that can be used to access table data from OceanBase storage layer. Its access method is different

OceanBase 12 Dec 16, 2022
Simplifies the development of creating a JPA-based data access layer.

Spring Data JPA Spring Data JPA, part of the larger Spring Data family, makes it easy to easily implement JPA based repositories. This module deals wi

Spring 2.5k Jan 5, 2023
An intelliJ plugin providing a UI layer for git-flow, which in itself is a collection of Git extensions to provide high-level repository operations for Vincent Driessen's branching model.

Git Flow Integration Plus for Intellij An intelliJ plugin providing a UI layer for git-flow, which in itself is a collection of Git extensions to prov

RubinCarter 35 Nov 8, 2022
Stetho is a debug bridge for Android applications, enabling the powerful Chrome Developer Tools and much more.

Stetho Stetho is a sophisticated debug bridge for Android applications. When enabled, developers have access to the Chrome Developer Tools feature nat

Meta 12.6k Jan 3, 2023