Skip to content
/ amber Public

Amber is an annotation-based YAML library that utilizes interfaces to make clean configuration files.

License

Notifications You must be signed in to change notification settings

98ping/amber

Repository files navigation

amberLogo

Amber

Amber is an annotation-based YAML library that utilizes interfaces to make clean configuration files. Amber has support for custom type-transformers allowing you to use more than just primitive YAML-supported types in your configurations. You can create as many transformers as you would like. This feature makes amber feel more like a JSON-oriented configuration system than YAML.

Usage

To initialize amber, you need to use the function

AmberConfigurationService.make(path, debugMode)

The path would be the file location of where you want the YAML file to be stored.

To accept a new configuration into the service, you must make an interface and annotate it properly. A properly-annotated interface looks something like this:

interface CustomersConfig
{
    @EntryName("bob")
    @Path("customers")
    @DefaultString("Awesome Guy")
    fun onCustomerBob() : String

    @EntryName("bobVisits")
    @Path("customers")
    @DefaultInteger(100)
    fun onBobVisitCheck() : Int
}

Once you have setup this portion of the config, you can use the function:

AmberConfigurationService.from(CustomersConfig::class.java, "yourFileName.yaml" )

This function returns the interface so you can pull your values directly from the config.

About

Amber is an annotation-based YAML library that utilizes interfaces to make clean configuration files.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages