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

Add support for nested keys #326

Open
wants to merge 11 commits into
base: master
Choose a base branch
from

Conversation

Tomkowski
Copy link

Current solution does not allow nesting keys in variable expansion for the @Key annnotation.
Let us assume the following scenario:

    @Key("environment")
    @DefaultValue("global")
    String env();

    @Key("environments.${environment}.webdriver.url")
    String webDriverUrl();

    @Key("environments.${environment}.browser")
    @DefaultValue("chrome")
    String usedBrowser();

I want to have a property based on the selected browser property which is already based on the selected environment property. I am trying to access the property in the following ways:

    @Key("environments.${environment}.webdriver.${usedBrowser}.switches")
    String webDriverOptions();
    @Key("environments.${environment}.webdriver.${environments.${environment}.browser}.switches")
    String webDriverOptions();

but neither solution is working.
This pull request adds ability to nest variable expansion inside @Key annotiation.

@Tomkowski Tomkowski marked this pull request as ready for review December 4, 2022 20:25
@Tomkowski
Copy link
Author

Interestingly enough, my solution also enables properties to have curly brackets in its name. E.g.: {name} is now a valid property name. I am not sure whether it is a real case scenario or just some corner case.

@Tomkowski Tomkowski marked this pull request as draft December 6, 2022 07:32
@Tomkowski Tomkowski marked this pull request as ready for review December 11, 2022 09:58
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

Successfully merging this pull request may close these issues.

None yet

1 participant