Tamaya Optional (Extension Module)

Tamaya Optional is an extension module. Refer to the extensions documentation for further details.

What functionality this module provides ?

Tamaya Optional is for projects that want to benefit from Tamaya configuration optionally only. E.g. doing an OSS project you can declare to support configuration with Tamaya as an optional extension. This module can be added as a hard dependency to your code, hereby adding only three artifacts. The optional module automatically checks the availability of Tamaya on the classpath and only if available it tries to access it for configuration evaluation. Additionally an EvaluationPolicy lets you define the precedence of configured values (yours, or Tamaya ones, if present).


The module is based on Java 8.


To use Tamaya optional you only must add the corresponding dependency to your module:


Reading configuration using the Tamaya Optional Module

Tamaya Optional allows reading configuration with a small subset of functionality only. For more advanced use cases consider using the Apache Tamaya as your main configuration API. When creating your OptionalConfiguration instance you also pass the logic to access a value with your own configuration logic. Tamaya Optional will delegate to your logic as needed (depending on the EvaluationPolicy).

BigDecimal interestRate =
                    (k) -> MyConfigMechanism.get(k) // String get(String key);
                .get("com.mycomp.ratecalculator.rate", BigDecimal.class))