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

Runtime variable interpolation #85

Open
mmadson opened this issue Jul 10, 2014 · 1 comment
Open

Runtime variable interpolation #85

mmadson opened this issue Jul 10, 2014 · 1 comment

Comments

@mmadson
Copy link

mmadson commented Jul 10, 2014

Is it possible to leverage Owner's variable expansion support to perform runtime variable interpolation on strings?

For example, say I have an owner interface that defines a property

public interface MyConfig extends Config {

    @DefaultValue("/root")
    String rootPath();
}

Would it be possible to do something like:

assertEquals("/root/some/other/text", myConfigInstance.interpolate("${rootPath}/some/other/text"));

assuming of course that the the default value for rootPath was not overridden during this test.

Thanks!

EDIT:

After taking a quick peek at the code, it looks like this would be pretty easy to support by adding a new method to the Accessible interface (or perhaps a new extension interface?) along with a corresponding @DeleGate method to the PropertiesManager class. If you like this idea, I can fork, impl and submit a pull request.

@lviggiano
Copy link
Collaborator

Hi @mmadson.

I like the idea, and I support your solution 👍

Feel free to fork and provide your implementation. Also write a unit test for it (patches without a unit tests are not accepted).

Thanks.

Luigi.

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

No branches or pull requests

2 participants