Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrap Properties, in addition to ResourceBundles #6

Closed
julianhyde opened this issue Nov 30, 2016 · 1 comment
Closed

Wrap Properties, in addition to ResourceBundles #6

julianhyde opened this issue Nov 30, 2016 · 1 comment

Comments

@julianhyde
Copy link
Owner

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.

@julianhyde
Copy link
Owner Author

Fixed in 9061d8a. (In 0.6 release.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant