Closed
Description
I want to create a map from properties using JavaPropsMapper, which works as long as the keys for the map don't contain dots.
I have something like this:
Config expResult = new Config(
new Config.Server(17, "/path", "param1", "param2", "Wobble")
, ImmutableMap.<String, String>builder().put("x.y", "y").put("a.b", "b").build()
);
System.setProperty("server.arg", "param1");
System.setProperty("map.x.y", "y");
And when I run that through the JavaPropsMapper it falls over because it creates:
{"map":{"x":{"y":"y"}}}
when what I want is:
{"map":{"x.y":"y"}}
(I want to have domain names as keys)
It would be nice if there was some way to escape the dots in property names so that they weren't considered to be delimiters.
I could probably make this work by configuring a completely different delimiter, but that would just confuse anyone wanting to work with this.
Things I've tried, any of which would be an OK solution for me, are:
System.setProperty("map[x.y]", "y");
System.setProperty("map.[x.y]", "y");
System.setProperty("map.x\\.y", "y");
System.setProperty("map.'x.y'", "y");
System.setProperty("map.x'.'y", "y");