Skip to content

A lightweight yet highly customizable property library for Java

License

Notifications You must be signed in to change notification settings

LeafClient/Swiftbird

Repository files navigation

Swiftbird

Codacy Badge

Swiftbird is a library created for Leaf that allows the creation of what we call "Property" (a.k.a Setting).
The default implementation wrote by Shyrogan is annotation-based (see the Default Implementation section).

Default implementation

Declaring some properties

Declaring a property works with annotation:

class Configuration {

    @Property(value = "Cheese", description = "It adds cheese, I guess?")
    private boolean cheese = false;

}

will tell Swiftbird to considere the cheese field as a property.

Retrieving your properties

In order to retrieve your properties, you have to create a Swiftbird instance using the create() method.
Then, you can get the properties in their PropertyContainer form.

class Main {

    private final Swiftbird swiftbird = Swiftbird.create();

    public static void main(String[] args) {
        List<PropertyContainer<?>> properties = swiftbird.in(new Configuration());
    }

}