Class PrefixedValueSourceWrapper

  • All Implemented Interfaces:
    FixedValueSource

    public class PrefixedValueSourceWrapper
    extends java.lang.Object
    implements FixedValueSource
    FixedValueSource 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 Summary

      Constructors 
      Constructor Description
      PrefixedValueSourceWrapper​(FixedValueSource valueSource, java.lang.String prefix)
      Wrap the given value source, but first trim the given prefix from any expressions before they are passed along for resolution.
      PrefixedValueSourceWrapper​(FixedValueSource valueSource, java.lang.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.
      PrefixedValueSourceWrapper​(FixedValueSource valueSource, java.util.List<java.lang.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​(FixedValueSource valueSource, java.util.List<java.lang.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.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.Object getValue​(java.lang.String expression, InterpolationState interpolationState)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • possiblePrefixes

        private final java.lang.String[] possiblePrefixes
      • allowUnprefixedExpressions

        private boolean allowUnprefixedExpressions
      • lastExpression

        private java.lang.String lastExpression
    • Constructor Detail

      • PrefixedValueSourceWrapper

        public PrefixedValueSourceWrapper​(FixedValueSource valueSource,
                                          java.lang.String prefix)
        Wrap the given value source, but first trim the given prefix from any expressions before they are passed along for resolution. If an expression doesn't start with the given prefix, do not resolve it.
        Parameters:
        valueSource - The ValueSource to wrap.
        prefix - The expression prefix to trim.
      • PrefixedValueSourceWrapper

        public PrefixedValueSourceWrapper​(FixedValueSource valueSource,
                                          java.lang.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. If an expression doesn't start with the given prefix and the allowUnprefixedExpressions flag is set to true, simply pass the expression through to the nested value source unchanged. If this flag is false, only allow resolution of those expressions that start with the specified prefix.
        Parameters:
        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.
      • PrefixedValueSourceWrapper

        public PrefixedValueSourceWrapper​(FixedValueSource valueSource,
                                          java.util.List<java.lang.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. If an expression doesn't start with one of the given prefixes, do not resolve it.
        Parameters:
        valueSource - The ValueSource to wrap.
        possiblePrefixes - The List of expression prefixes to trim.
      • PrefixedValueSourceWrapper

        public PrefixedValueSourceWrapper​(FixedValueSource valueSource,
                                          java.util.List<java.lang.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. If an expression doesn't start with the given prefix and the allowUnprefixedExpressions flag is set to true, simply pass the expression through to the nested value source unchanged. If this flag is false, only allow resolution of those expressions that start with the specified prefix.
        Parameters:
        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.
    • Method Detail

      • getValue

        public java.lang.Object getValue​(java.lang.String expression,
                                         InterpolationState interpolationState)
        Specified by:
        getValue in interface FixedValueSource
        Parameters:
        expression - The expression.
        interpolationState - InterpolationState.
        Returns:
        the value related to the expression, or null if not found (not available from this source)