org.apache.logging.log4j.core.lookup
Class Interpolator

java.lang.Object
  extended by org.apache.logging.log4j.core.lookup.Interpolator
All Implemented Interfaces:
StrLookup

public class Interpolator
extends Object
implements StrLookup

The Interpolator is a StrLookup that acts as a proxy for all the other StrLookups.


Constructor Summary
Interpolator()
           
Interpolator(StrLookup defaultLookup)
           
 
Method Summary
 String lookup(LogEvent event, String var)
          Resolves the specified variable.
 String lookup(String var)
          Resolves the specified variable.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Interpolator

public Interpolator(StrLookup defaultLookup)

Interpolator

public Interpolator()
Method Detail

lookup

public String lookup(String var)
Resolves the specified variable. This implementation will try to extract a variable prefix from the given variable name (the first colon (':') is used as prefix separator). It then passes the name of the variable with the prefix stripped to the lookup object registered for this prefix. If no prefix can be found or if the associated lookup object cannot resolve this variable, the default lookup object will be used.

Specified by:
lookup in interface StrLookup
Parameters:
var - the name of the variable whose value is to be looked up
Returns:
the value of this variable or null if it cannot be resolved

lookup

public String lookup(LogEvent event,
                     String var)
Resolves the specified variable. This implementation will try to extract a variable prefix from the given variable name (the first colon (':') is used as prefix separator). It then passes the name of the variable with the prefix stripped to the lookup object registered for this prefix. If no prefix can be found or if the associated lookup object cannot resolve this variable, the default lookup object will be used.

Specified by:
lookup in interface StrLookup
Parameters:
event - The current LogEvent or null.
var - the name of the variable whose value is to be looked up
Returns:
the value of this variable or null if it cannot be resolved

toString

public String toString()
Overrides:
toString in class Object


Copyright © 1999-2012 Apache Software Foundation. All Rights Reserved. Apache Logging, Apache Log4j, Log4j, Apache, the Apache feather logo, and the Apache Logging project logo are trademarks of The Apache Software Foundation.