Skip to content

Add @TomlIgnore and @TomlComment annotations - #65

Open
ErdbeerbaerLP wants to merge 20 commits into
mwanji:wipfrom
ErdbeerbaerLP:wip
Open

ErdbeerbaerLP wants to merge 20 commits into
mwanji:wipfrom
ErdbeerbaerLP:wip

Conversation

@ErdbeerbaerLP

Copy link
Copy Markdown

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
Copy Markdown

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

stjepanmamusa commented Sep 23, 2021 •

Copy link
Copy Markdown

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.

4 participants