Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add @TomlIgnore and @TomlComment annotations #65

Open
wants to merge 18 commits into
base: wip
Choose a base branch
from

Conversation

ErdbeerbaerLP
Copy link

I added two annotations to this library:

  • @TomlIgnore

    Fields with this annotation will not get written to the toml file.

  • @TomlComment

    When adding this annotation to an field, the value of this annotation will get written as comment above the toml entry

Example:

public class SomeConfig {
   @TomlIgnore
   public int secretInteger = 42;

   @TomlComment("This is an comment")
   public String key1 = "value1";

   @TomlComment({"This is an", "multilined comment"})
   public String key2 = "value2";

   @TomlComment("This is also\nan multilined comment")
   public String key3 = "value3";
}

Written to toml file using TomlWriter:

# This is an comment
key1 = "value1"
# This is an
# multilied comment
key2 = "value2"
# This is also
# an multilined comment
key3 = "value3"

Need another use example? I already used it here to create an configuration file

@Dragon-Seeker
Copy link

I honestly would love for this PR to get merged as it would be great to have comments thru annotations. It seems to work for my case as i'm currently using it to generate config files for a game without issue

@stjepanmamusa
Copy link

stjepanmamusa commented Sep 23, 2021

I'd like to see this merged also, I'm writing a config generator for InfluxData Telegraf Monitoring agent, and these would help a lot.
@mwanji any updates on this being merged?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants