Skip to content

shateq/inicere

Repository files navigation

Experimental concept - Inicere

Lightweight, practical library for working with TOML files. Goal: Lightweight work multiple files using simple (with event handler)

Table of Contents

  1. Start
  2. Examples
  3. Develop
  4. License

Getting started

Add as a dependency

Gradle

repositories {
    maven { url "https://jitpack.io" }
}

dependencies {
    implementation("cf.shateq:inicere-core:(Version tag)")
}

Examples

Examples project

Inicere instance
class A {
    @Element("object")
    public boolean good = false;

    public void initialize() {
        AnyName object = new AnyName();
        // Key-value store
        Inicere inicere = new Inicere(Path.of("fileName.toml")); // Simple way

        inicere.set("some.key", 3.14);
        inicere.get("some.key"); // 3.14

        // Reflection, requires you to bind an object
        Inicere binding = new Inicere.Phi()
                .setFile(Path.of("file-name.toml"))
                .setObject(object)
                .build(); // Hard way

        binding.set("object", true);
        object.good; // true
    }
}
Class serialization
class B {
     void func() {
        Inicere paths = new Inicere(Path.of("file-name.toml"));
        paths.bind(new DefaultFile());
        paths.bound().key$to$integer; // 2

        paths.set("key.to.integer", 4);
        paths.bound().key$to$integer; // 4

        Inicere sections = new Inicere(new AsAFile());

        sections.set("version", "1.0.1");
        sections.get("version"); // "1.0.1"
    }

    @DataSection
    class DefaultFile {
        public boolean bool = false;
        public int key$to$integer = 2;
        // This field won't be processed
        transient String weatherOutside = "appealing";
    }

    @DataSection("as-a-file.toml")
    class AsAFile {
        String version = "1.0.0";
        double pi = 3.14;
    }
}

Develop

Gradle guides, modules

License

Licensed under MIT. Check LICENSE file for details.

About

Currently rewritten... Hard working

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published