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

[api] Writers #305

Open
Gmugra opened this issue Feb 1, 2022 · 0 comments
Open

[api] Writers #305

Gmugra opened this issue Feb 1, 2022 · 0 comments
Labels
enhancement New feature or request low priority

Comments

@Gmugra
Copy link
Owner

Gmugra commented Feb 1, 2022

Initial concept:

  • (?) net.cactusthorn.config.core.Accessible should get method to provide "meta" information about property e.g. info about separators for collections.
  • New Writer Interface with method: void write(net.cactusthorn.config.core.Accessible accessible)
  • Sure need Writer implementatin for each file format based on URI pattern (same like with Loaders)
  • New WriterFactory class with static(?) method Writer create(String uri)
  • WriterFactory use SPI to load Writer implmenetations (same way like with Loaders)

Usage something like that:

@Config public interface MyConfig extends Accessible {
...
}
MyConfig myConfig = ConfigFactory.builder().addSource("file:/myconfig.properties").build().create(MyConfig.class);
Writer writer = WriterFactory.create("file:~/myconfig.toml");
writer.write(myConfig); //save data in TOML format  in user home directory.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request low priority
Projects
None yet
Development

No branches or pull requests

1 participant