Description
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.