Philipp and I meet today at BEDCON and discussed the pros and cons. We think we should not use Optional as a possible return type but we could/should a similar functionality.

What do you think about this example code?

Configuration c = ConfigurationProvider.getConfiguration();

String value1 = c.key("K1").get();
String value2 = c.key("K2").getOrThrow(() -> new RuntimeException());
String value3 = c.key("K3").getOrElse(() -> "DEFAULT")
String value4 = c.key("K4").map(v -> v).get()

WDYT?

Oliver

Am 21.09.17 um 13:52 schrieb John D. Ament:
Hi

I was wondering, would it make sense for Tamaya to handle within its core
usage of Optional?  Its required by MP, however the code looks a bit
disjointed in how it works.  The method MicroprofileConfig.getOptionalValue
looks elegant, but it seems there's no handling of the optional values
properly in the producer method.

John


--
N Oliver B. Fischer
A Schönhauser Allee 64, 10437 Berlin, Deutschland/Germany
P +49 30 44793251
M +49 178 7903538
E [email protected]
S oliver.b.fischer
J [email protected]
X http://xing.to/obf

Reply via email to