public class PrefixedValueSourceWrapper extends Object implements FeedbackEnabledValueSource, QueryEnabledValueSource
ValueSource
implementation which simply wraps another value source,
and trims any of a set of possible expression prefixes before delegating the
modified expression to be resolved by the real value source.Constructor and Description |
---|
PrefixedValueSourceWrapper(ValueSource valueSource,
List<String> possiblePrefixes)
Wrap the given value source, but first trim one of the given prefixes from any
expressions before they are passed along for resolution.
|
PrefixedValueSourceWrapper(ValueSource valueSource,
List<String> possiblePrefixes,
boolean allowUnprefixedExpressions)
Wrap the given value source, but first trim one of the given prefixes from any
expressions before they are passed along for resolution.
|
PrefixedValueSourceWrapper(ValueSource valueSource,
String prefix)
Wrap the given value source, but first trim the given prefix from any
expressions before they are passed along for resolution.
|
PrefixedValueSourceWrapper(ValueSource valueSource,
String prefix,
boolean allowUnprefixedExpressions)
Wrap the given value source, but first trim the given prefix from any
expressions before they are passed along for resolution.
|
Modifier and Type | Method and Description |
---|---|
void |
clearFeedback()
If the nested
ValueSource implements FeedbackEnabledValueSource ,
then clear that source's feedback list. |
List |
getFeedback()
If the nested
ValueSource implements FeedbackEnabledValueSource ,
then return that source's feedback list. |
String |
getLastExpression()
If the nested
ValueSource implements QueryEnabledValueSource ,
then return that source's last expression. |
Object |
getValue(String expression)
Uses
ValueSourceUtils.trimPrefix(String, java.util.Collection, boolean) to
get the trimmed expression. |
public PrefixedValueSourceWrapper(ValueSource valueSource, String prefix)
valueSource
- The ValueSource
to wrap.prefix
- The expression prefix to trim.public PrefixedValueSourceWrapper(ValueSource valueSource, String prefix, boolean allowUnprefixedExpressions)
valueSource
- The ValueSource
to wrap.prefix
- The expression prefix to trim.allowUnprefixedExpressions
- Flag telling the wrapper whether to
continue resolving expressions that don't start with the prefix it tracks.public PrefixedValueSourceWrapper(ValueSource valueSource, List<String> possiblePrefixes)
valueSource
- The ValueSource
to wrap.possiblePrefixes
- The List of expression prefixes to trim.public PrefixedValueSourceWrapper(ValueSource valueSource, List<String> possiblePrefixes, boolean allowUnprefixedExpressions)
valueSource
- The ValueSource
to wrap.possiblePrefixes
- The List of expression prefixes to trim.allowUnprefixedExpressions
- Flag telling the wrapper whether to
continue resolving expressions that don't start with one of the prefixes it tracks.public Object getValue(String expression)
ValueSourceUtils.trimPrefix(String, java.util.Collection, boolean)
to
get the trimmed expression. If this expression is null (because the original
expression was null, or because the expression is unprefixed and unprefixed
expressions are not allowed here), then return null; otherwise, return the
nested ValueSource.getValue(String)
result.getValue
in interface ValueSource
public List getFeedback()
ValueSource
implements FeedbackEnabledValueSource
,
then return that source's feedback list. Otherwise, return Collections.EMPTY_LIST
.getFeedback
in interface ValueSource
public String getLastExpression()
ValueSource
implements QueryEnabledValueSource
,
then return that source's last expression. Otherwise, return the last expression
that was processed by the wrapper itself.getLastExpression
in interface QueryEnabledValueSource
public void clearFeedback()
ValueSource
implements FeedbackEnabledValueSource
,
then clear that source's feedback list.clearFeedback
in interface ValueSource
Copyright © 2019. All rights reserved.