Interface Lookup

All Known Implementing Classes:
ConfigurationLookup, ConstantLookup, DummyLookup, EnvironmentLookup, ExprLookup, SystemPropertiesLookup

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.

Since:
2.0
  • Method Summary

    Modifier and Type
    Method
    Description
    lookup(String variable)
    Looks up the value of the specified variable.
  • Method Details

    • lookup

      Object lookup(String variable)
      Looks up the value of the specified variable. This method is called by 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.
      Parameters:
      variable - the name of the variable to be resolved
      Returns:
      the value of this variable or null