Skip to content

No straightforward way to collect not resolved expressions #22

Closed
@errandir

Description

@errandir

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.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions