Simplix-Softworks / SimplixStorage

Library to store data in a better way
Apache License 2.0
138 stars 25 forks source link

Add annotations and annotations parsing #65

Closed Nuckerr closed 2 years ago

Nuckerr commented 2 years ago

Example:

public class ExampleClass {
    @Getter
     @Config("ban-message")
    public String banMessage;
}
public class ExamplePlugin extends JavaPlugin {
    public void onEnable() {
        Yaml config = new Yaml(...);
        config.annotateClass(new ExampleClass());
       this.getLogger().info(config.getBanMessage());
    }
}
yoyosource commented 2 years ago

Your example is illogical. You cannot get the ban message with getBanMessage() on the config Object as the method is not present. Did you mean:

public class ExampleClass {
    @Getter
    @Config("ban-message")
    public String banMessage;
}
public class ExamplePlugin extends JavaPlugin {
    public void onEnable() {
        Yaml config = new Yaml(...);
        ExampleClass exampleClass = ExampleClass();
        config.annotateClass(exampleClass);
        this.getLogger().info(exampleClass.getBanMessage());
    }
}
KotlinFactory commented 2 years ago

Hey,

Thanks for contributing to SimplixStorage.

This pull request looks promising however you need to revert the "optimize-imports" commit as it does not align with our code style requirements.

Regards, Leonhard

Nuckerr commented 2 years ago

Your example is illogical. You cannot get the ban message with getBanMessage() on the config Object as the method is not present. Did you mean:

public class ExampleClass {
    @Getter
    @Config("ban-message")
    public String banMessage;
}
public class ExamplePlugin extends JavaPlugin {
    public void onEnable() {
        Yaml config = new Yaml(...);
        ExampleClass exampleClass = ExampleClass();
        config.annotateClass(exampleClass);
        this.getLogger().info(exampleClass.getBanMessage());
    }
}

Yeah, my bad

KotlinFactory commented 2 years ago

Thank you so much for this PR. Will have a more detailed look soon but it looks good that we can merge this!

KotlinFactory commented 2 years ago

Merged, thanks. We can implement the requested changes later.