ConfigBeanFactory.create supports the ability to create a typed object with a single method call which is very nice. I am using java 17 and would like to use a record instead of a java bean to take advantage of the much reduced boilerplate possible when using java records.
My proposal is something along the lines of the following:
record MyConfig(String uri, Integer port);
var map = Map.of(
"uri", "localhost",
"port", "1234");
var fullConfig = ConfigFactory.parseMap(map)
var myConfig = ConfigRecordFactory.create(fullConfig, MyConfig.class);
assertThat(myConfig.uri(), equalTo("localhost"));
assertThat(myConfig.port(), equalTo("1234"));
ConfigBeanFactory.create
supports the ability to create a typed object with a single method call which is very nice. I am using java 17 and would like to use arecord
instead of a java bean to take advantage of the much reduced boilerplate possible when using java records.My proposal is something along the lines of the following:
Thanks for this great library!