Change property's path

It's like a Russian doll!

To modify where sc-cfg will save your fields, you can annotate them with @Path to specify a path, or @NamedPath to specify a path and name to your property at once.

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

@Configuration
public class MyConfig {
    
    // annotate the field with @Path and provide the new path, separate each layer with a dot
    @Path("options.general")
    public int someInt = 0;
    
    @Path("options.general.other")
    public final String someString = "rock";
    
    // or use the combo annotation, NamedPath
    @NamedPath(path = "the.path", name = "anotherName")
    public String someOtherString = "edisson";
}

Will be serialized.

options:
  general:
    someInt: 0
    other:
      someString: "rock"
the:
  path:
    anotherName: "edisson"

Last updated