public interface Lookup
Definition of an interface for looking up variables during interpolation.
Objects implementing this interface can be assigned a variable prefix and
added to a ConfigurationInterpolator
object. Whenever the
ConfigurationInterpolator
encounters a property value referencing a
variable, e.g. ${prefix:variableName}
, it extracts the prefix
and finds the matching Lookup
object. Then this object is asked to
resolve the variable name and provide the corresponding value.
This interface defines a single method for performing variable lookup. It is passed the name of a variable and has to return the corresponding value. It is of course up to a specific implementation how this is done. If the variable name cannot be resolved, an implementation has to return null.
Note: Implementations must be aware that they can be accessed concurrently.
This is for instance the case if a configuration object is read by multiple
threads or if a Lookup
object is shared by multiple configurations.
Modifier and Type | Method and Description |
---|---|
Object |
lookup(String variable)
Looks up the value of the specified variable.
|
Object lookup(String variable)
ConfigurationInterpolator
with the variable name extracted from
the expression to interpolate (i.e. the prefix name has already been
removed). A concrete implementation has to return the value of this
variable or null if the variable name is unknown.variable
- the name of the variable to be resolvedCopyright © 2001–2020 The Apache Software Foundation. All rights reserved.