MCRConfiguration2 with support for Optional and EventListener

Description

We have the following use cases

  1. A class needs a property and has a default value or handles the missing value somehow

  2. A class needs a value for a property to work

  3. A class may want to reconfigure itself upon a runtime property change

Currently we define 2. as our default and throw an Exception while we more often supply a default value of null and handle the returned value with null-checks somehow later.

Java 8 introduced Optional. This is a great class to handle use case 1. As this class provides mapping to different return types than String, it will allow us to provide us with cool API stuff:

For use case 3. we currently have no mechanism but simple polling. Java 8 gifts us FunctionalInterfaces and Predicates. Together with lambdas it will allow us to easily reconfigure classes in runtime.

Lets discuss this here and gather some ideas.

Environment

None

Assignee

Thomas Scheffler

Reporter

Thomas Scheffler

Labels

None

URL

None

External issue ID

None

Components

Fix versions

Priority

Medium
Configure