blob: a45ad4f65c58cde117d955373d1b9d8573be8d23 [file] [log] [blame]
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!--NewPage-->
<HTML>
<HEAD>
<!-- Generated by javadoc (build 1.6.0_31) on Sat Jun 09 14:24:14 MST 2012 -->
<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
<TITLE>
StrLookup (Log4J Core 2.0-alpha1-SNAPSHOT API)
</TITLE>
<META NAME="date" CONTENT="2012-06-09">
<LINK REL ="stylesheet" TYPE="text/css" HREF="../../../../../../stylesheet.css" TITLE="Style">
<SCRIPT type="text/javascript">
function windowTitle()
{
if (location.href.indexOf('is-external=true') == -1) {
parent.document.title="StrLookup (Log4J Core 2.0-alpha1-SNAPSHOT API)";
}
}
</SCRIPT>
<NOSCRIPT>
</NOSCRIPT>
</HEAD>
<BODY BGCOLOR="white" onload="windowTitle();">
<HR>
<!-- ========= START OF TOP NAVBAR ======= -->
<A NAME="navbar_top"><!-- --></A>
<A HREF="#skip-navbar_top" title="Skip navigation links"></A>
<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
<TR>
<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
<A NAME="navbar_top_firstrow"><!-- --></A>
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
<TR ALIGN="center" VALIGN="top">
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A>&nbsp;</TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A>&nbsp;</TD>
<TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT>&nbsp;</TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="class-use/StrLookup.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A>&nbsp;</TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A>&nbsp;</TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A>&nbsp;</TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A>&nbsp;</TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A>&nbsp;</TD>
</TR>
</TABLE>
</TD>
<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
</EM>
</TD>
</TR>
<TR>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
&nbsp;<A HREF="../../../../../../org/apache/logging/log4j/core/lookup/MapLookup.html" title="class in org.apache.logging.log4j.core.lookup"><B>PREV CLASS</B></A>&nbsp;
&nbsp;<A HREF="../../../../../../org/apache/logging/log4j/core/lookup/StrMatcher.html" title="class in org.apache.logging.log4j.core.lookup"><B>NEXT CLASS</B></A></FONT></TD>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../../../../../index.html?org/apache/logging/log4j/core/lookup/StrLookup.html" target="_top"><B>FRAMES</B></A> &nbsp;
&nbsp;<A HREF="StrLookup.html" target="_top"><B>NO FRAMES</B></A> &nbsp;
&nbsp;<SCRIPT type="text/javascript">
<!--
if(window==top) {
document.writeln('<A HREF="../../../../../../allclasses-noframe.html"><B>All Classes</B></A>');
}
//-->
</SCRIPT>
<NOSCRIPT>
<A HREF="../../../../../../allclasses-noframe.html"><B>All Classes</B></A>
</NOSCRIPT>
</FONT></TD>
</TR>
<TR>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
SUMMARY:&nbsp;NESTED&nbsp;|&nbsp;FIELD&nbsp;|&nbsp;CONSTR&nbsp;|&nbsp;<A HREF="#method_summary">METHOD</A></FONT></TD>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
DETAIL:&nbsp;FIELD&nbsp;|&nbsp;CONSTR&nbsp;|&nbsp;<A HREF="#method_detail">METHOD</A></FONT></TD>
</TR>
</TABLE>
<A NAME="skip-navbar_top"></A>
<!-- ========= END OF TOP NAVBAR ========= -->
<HR>
<!-- ======== START OF CLASS DATA ======== -->
<H2>
<FONT SIZE="-1">
org.apache.logging.log4j.core.lookup</FONT>
<BR>
Interface StrLookup&lt;V&gt;</H2>
<DL>
<DT><DT><B>Type Parameters:</B><DD><CODE>V</CODE> - The type of the value that is being queried.</DL>
<DL>
<DT><B>All Known Implementing Classes:</B> <DD><A HREF="../../../../../../org/apache/logging/log4j/core/lookup/ContextMapLookup.html" title="class in org.apache.logging.log4j.core.lookup">ContextMapLookup</A>, <A HREF="../../../../../../org/apache/logging/log4j/core/lookup/DateLookup.html" title="class in org.apache.logging.log4j.core.lookup">DateLookup</A>, <A HREF="../../../../../../org/apache/logging/log4j/core/lookup/EnvironmentLookup.html" title="class in org.apache.logging.log4j.core.lookup">EnvironmentLookup</A>, <A HREF="../../../../../../org/apache/logging/log4j/core/lookup/Interpolator.html" title="class in org.apache.logging.log4j.core.lookup">Interpolator</A>, <A HREF="../../../../../../org/apache/logging/log4j/core/lookup/MapLookup.html" title="class in org.apache.logging.log4j.core.lookup">MapLookup</A>, <A HREF="../../../../../../org/apache/logging/log4j/core/lookup/StructuredDataLookup.html" title="class in org.apache.logging.log4j.core.lookup">StructuredDataLookup</A>, <A HREF="../../../../../../org/apache/logging/log4j/core/lookup/SystemPropertiesLookup.html" title="class in org.apache.logging.log4j.core.lookup">SystemPropertiesLookup</A></DD>
</DL>
<HR>
<DL>
<DT><PRE>public interface <A HREF="../../../../../../src-html/org/apache/logging/log4j/core/lookup/StrLookup.html#line.39"><B>StrLookup&lt;V&gt;</B></A></DL>
</PRE>
<P>
Lookup a String key to a String value.
<p>
This class represents the simplest form of a string to string map.
It has a benefit over a map in that it can create the result on
demand based on the key.
<p>
This class comes complete with various factory methods.
If these do not suffice, you can subclass and implement your own matcher.
<p>
For example, it would be possible to implement a lookup that used the
key as a primary key, and looked up the value on demand from the database
<P>
<P>
<DL>
<DT><B>Version:</B></DT>
<DD>$Id$</DD>
<DT><B>Author:</B></DT>
<DD>Apache Software Foundation</DD>
</DL>
<HR>
<P>
<!-- ========== METHOD SUMMARY =========== -->
<A NAME="method_summary"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2">
<B>Method Summary</B></FONT></TH>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;<A HREF="http://download.oracle.com/javase/1.5.0/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A></CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../../org/apache/logging/log4j/core/lookup/StrLookup.html#lookup(org.apache.logging.log4j.core.LogEvent, java.lang.String)">lookup</A></B>(<A HREF="../../../../../../org/apache/logging/log4j/core/LogEvent.html" title="interface in org.apache.logging.log4j.core">LogEvent</A>&nbsp;event,
<A HREF="http://download.oracle.com/javase/1.5.0/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A>&nbsp;key)</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Looks up a String key to a String value possibly using the current LogEvent.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;<A HREF="http://download.oracle.com/javase/1.5.0/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A></CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../../org/apache/logging/log4j/core/lookup/StrLookup.html#lookup(java.lang.String)">lookup</A></B>(<A HREF="http://download.oracle.com/javase/1.5.0/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A>&nbsp;key)</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Looks up a String key to a String value.</TD>
</TR>
</TABLE>
&nbsp;
<P>
<!-- ============ METHOD DETAIL ========== -->
<A NAME="method_detail"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2">
<B>Method Detail</B></FONT></TH>
</TR>
</TABLE>
<A NAME="lookup(java.lang.String)"><!-- --></A><H3>
lookup</H3>
<PRE>
<A HREF="http://download.oracle.com/javase/1.5.0/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A> <A HREF="../../../../../../src-html/org/apache/logging/log4j/core/lookup/StrLookup.html#line.63"><B>lookup</B></A>(<A HREF="http://download.oracle.com/javase/1.5.0/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A>&nbsp;key)</PRE>
<DL>
<DD>Looks up a String key to a String value.
<p>
The internal implementation may use any mechanism to return the value.
The simplest implementation is to use a Map. However, virtually any
implementation is possible.
<p>
For example, it would be possible to implement a lookup that used the
key as a primary key, and looked up the value on demand from the database
Or, a numeric based implementation could be created that treats the key
as an integer, increments the value and return the result as a string -
converting 1 to 2, 15 to 16 etc.
<p>
The <A HREF="../../../../../../org/apache/logging/log4j/core/lookup/StrLookup.html#lookup(java.lang.String)"><CODE>lookup(String)</CODE></A> method always returns a String, regardless of
the underlying data, by converting it as necessary. For example:
<pre>
Map<String, Object> map = new HashMap<String, Object>();
map.put("number", new Integer(2));
assertEquals("2", StrLookup.mapLookup(map).lookup("number"));
</pre>
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>key</CODE> - the key to be looked up, may be null
<DT><B>Returns:</B><DD>the matching value, null if no match</DL>
</DD>
</DL>
<HR>
<A NAME="lookup(org.apache.logging.log4j.core.LogEvent, java.lang.String)"><!-- --></A><H3>
lookup</H3>
<PRE>
<A HREF="http://download.oracle.com/javase/1.5.0/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A> <A HREF="../../../../../../src-html/org/apache/logging/log4j/core/lookup/StrLookup.html#line.89"><B>lookup</B></A>(<A HREF="../../../../../../org/apache/logging/log4j/core/LogEvent.html" title="interface in org.apache.logging.log4j.core">LogEvent</A>&nbsp;event,
<A HREF="http://download.oracle.com/javase/1.5.0/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A>&nbsp;key)</PRE>
<DL>
<DD>Looks up a String key to a String value possibly using the current LogEvent.
<p>
The internal implementation may use any mechanism to return the value.
The simplest implementation is to use a Map. However, virtually any
implementation is possible.
<p>
For example, it would be possible to implement a lookup that used the
key as a primary key, and looked up the value on demand from the database
Or, a numeric based implementation could be created that treats the key
as an integer, increments the value and return the result as a string -
converting 1 to 2, 15 to 16 etc.
<p>
The <A HREF="../../../../../../org/apache/logging/log4j/core/lookup/StrLookup.html#lookup(java.lang.String)"><CODE>lookup(String)</CODE></A> method always returns a String, regardless of
the underlying data, by converting it as necessary. For example:
<pre>
Map<String, Object> map = new HashMap<String, Object>();
map.put("number", new Integer(2));
assertEquals("2", StrLookup.mapLookup(map).lookup("number"));
</pre>
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>event</CODE> - The current LogEvent.<DD><CODE>key</CODE> - the key to be looked up, may be null
<DT><B>Returns:</B><DD>the matching value, null if no match</DL>
</DD>
</DL>
<!-- ========= END OF CLASS DATA ========= -->
<HR>
<!-- ======= START OF BOTTOM NAVBAR ====== -->
<A NAME="navbar_bottom"><!-- --></A>
<A HREF="#skip-navbar_bottom" title="Skip navigation links"></A>
<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
<TR>
<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
<A NAME="navbar_bottom_firstrow"><!-- --></A>
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
<TR ALIGN="center" VALIGN="top">
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A>&nbsp;</TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A>&nbsp;</TD>
<TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT>&nbsp;</TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="class-use/StrLookup.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A>&nbsp;</TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A>&nbsp;</TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A>&nbsp;</TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A>&nbsp;</TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A>&nbsp;</TD>
</TR>
</TABLE>
</TD>
<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
</EM>
</TD>
</TR>
<TR>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
&nbsp;<A HREF="../../../../../../org/apache/logging/log4j/core/lookup/MapLookup.html" title="class in org.apache.logging.log4j.core.lookup"><B>PREV CLASS</B></A>&nbsp;
&nbsp;<A HREF="../../../../../../org/apache/logging/log4j/core/lookup/StrMatcher.html" title="class in org.apache.logging.log4j.core.lookup"><B>NEXT CLASS</B></A></FONT></TD>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../../../../../index.html?org/apache/logging/log4j/core/lookup/StrLookup.html" target="_top"><B>FRAMES</B></A> &nbsp;
&nbsp;<A HREF="StrLookup.html" target="_top"><B>NO FRAMES</B></A> &nbsp;
&nbsp;<SCRIPT type="text/javascript">
<!--
if(window==top) {
document.writeln('<A HREF="../../../../../../allclasses-noframe.html"><B>All Classes</B></A>');
}
//-->
</SCRIPT>
<NOSCRIPT>
<A HREF="../../../../../../allclasses-noframe.html"><B>All Classes</B></A>
</NOSCRIPT>
</FONT></TD>
</TR>
<TR>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
SUMMARY:&nbsp;NESTED&nbsp;|&nbsp;FIELD&nbsp;|&nbsp;CONSTR&nbsp;|&nbsp;<A HREF="#method_summary">METHOD</A></FONT></TD>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
DETAIL:&nbsp;FIELD&nbsp;|&nbsp;CONSTR&nbsp;|&nbsp;<A HREF="#method_detail">METHOD</A></FONT></TD>
</TR>
</TABLE>
<A NAME="skip-navbar_bottom"></A>
<!-- ======== END OF BOTTOM NAVBAR ======= -->
<HR>
Copyright &#169; 1999-2012 <a href="http://www.apache.org">Apache Software Foundation</a>. All Rights Reserved.
</BODY>
</HTML>