Discussions have shown that many use cases that can not be covered by this JSR. This requires to add some more flexibility to some of the artifacts (value types) defined. It was basically agreed that this features should be minimized and modeled as type safe as possible:
- this feature is modelled by an interface called javax.money.util.AttributeProvider.
- attributes can be accessed by <T> T getAttribute(String key, Class<T> type).
- the current defined keys can be accessed by Enumeration<String> getAttributeKeys().
- It was decided to use an Enumeration since it is commonly used within the JDK and also matches better to the use case since Iterator#remove() is not supported.
- The attribute type for a key can be accessed by Class<?> getAttributeType(String key), if no such key is available null is returned.
Since adding attributes is not simple, it may be required that creating attributable instances may require using a 'builder pattern'.