Header and comments

Now with 2 times the normal information.

It's now possible to add a header to the file by setting the header property of your @Configuration annotation.

import com.github.secretx33.sccfg.api.*;

// add your header directly to your Configuration annotation
@Configuration(header = {​
    "I am the first line of the header",
    "and I am the second one",
​})
public class MyConfig {

    public int someValue = 0;
}

Becomes

# I am the first line of the header
# and I am the second one

someValue: 0

Comments

Comments can be added by using either @Comment or @NamedPath annotations directly on properties.

import com.github.secretx33.sccfg.api.*;

@Configuration
public class MyConfig {
    
    // add your desired comment(s) directy to your properties
    @Comment("this value is awesome")
    public int someValue = 0;
    
    @Comment({"but this one...", "this one ROCKS!"})
    private final String someString = "rock";
    
    @NamedPath(path = "good.path", name = "iDecidedOnThisName", comment = {"i am a comment"})
    private final double doubles = 1.53
}

Becomes

# this value is awesome
someValue: 0
# but this one...
# this one ROCKS!
someString: rock
good:
  path:
    # i am a comment
    iDecidedOnThisName: 1.53

Last updated