Skip to content

No straightforward way to collect not resolved expressions #22

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

Closed
errandir opened this issue May 28, 2019 · 0 comments
Closed

No straightforward way to collect not resolved expressions #22

errandir opened this issue May 28, 2019 · 0 comments

Comments

@errandir
Copy link
Contributor

Taking StringSearchInterpolator into account, I could not find a clear way to locate expressions that were not resolved. In the example below

String input = "Hello, ${other-key}";
StringSearchInterpolator interpolator = new StringSearchInterpolator();
interpolator.addValueSource( new MapBasedValueSource( singletonMap( "key", "val" ) ) );
String result = interpolator.interpolate( input );

the resulting string is Hello, ${other-key}, because expression was not resolved. In such case I would like to have a possibility at least to throw something like new IllegalArgumentException( "Some values were not resolved:" + result ). In a more advanced case I will have a possibility to list expressions passed to value sources (other-key), or even placeholders (${other-key}).

For now, I see feedbacks as a bus for such cases. The weak side of them is their String nature. One of the less intrusive solutions is to add some FeedbackingValueSource at the end of the sources list, which will add appropriate feedback if some unresolved expression will occur.

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