You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently the generated Resources class gets its values from a ResourceBundle, according to the current locale. But type-safe wrappers are just as useful for values that come from a Properties (or a similar map holding configuration info).
We propose to add new return types BooleanProp, IntProp, DoubleProp and StringProp indicating that methods return properties. Methods of these return types would support the existing @Resource annotation and a new @Default annotation.
Also add a new static Resources.create(Properties, Class) method to instantiate a resource interface that wraps Properties.
Lastly, introduce caching so that elements (properties and resource instances) are not instantiated every time a method is called, but re-used between calls, as long as the method has zero arguments. With this caching, we can do a little more work up-front when an element is created, and save time overall because we make fewer amortized calls to retrieve annotations.
The text was updated successfully, but these errors were encountered:
Currently the generated
Resources
class gets its values from aResourceBundle
, according to the current locale. But type-safe wrappers are just as useful for values that come from aProperties
(or a similar map holding configuration info).We propose to add new return types
BooleanProp
,IntProp
,DoubleProp
andStringProp
indicating that methods return properties. Methods of these return types would support the existing@Resource
annotation and a new@Default
annotation.Also add a new static
Resources.create(Properties, Class)
method to instantiate a resource interface that wrapsProperties
.Lastly, introduce caching so that elements (properties and resource instances) are not instantiated every time a method is called, but re-used between calls, as long as the method has zero arguments. With this caching, we can do a little more work up-front when an element is created, and save time overall because we make fewer amortized calls to retrieve annotations.
The text was updated successfully, but these errors were encountered: