Author: rgoers
Date: Fri Oct 28 06:10:32 2011
New Revision: 1190169
URL: http://svn.apache.org/viewvc?rev=1190169&view=rev
Log:
Add javadoc
Modified:
logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/main/java/org/apache/logging/log4j/core/appender/rewrite/MapRewritePolicy.java
Modified:
logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/main/java/org/apache/logging/log4j/core/appender/rewrite/MapRewritePolicy.java
URL:
http://svn.apache.org/viewvc/logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/main/java/org/apache/logging/log4j/core/appender/rewrite/MapRewritePolicy.java?rev=1190169&r1=1190168&r2=1190169&view=diff
==============================================================================
---
logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/main/java/org/apache/logging/log4j/core/appender/rewrite/MapRewritePolicy.java
(original)
+++
logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/main/java/org/apache/logging/log4j/core/appender/rewrite/MapRewritePolicy.java
Fri Oct 28 06:10:32 2011
@@ -32,7 +32,7 @@ import java.util.HashMap;
import java.util.Map;
/**
- *
+ * This policy modifies events by replacing or possibly adding keys and values
to the MapMessage.
*/
@Plugin(name = "MapRewritePolicy", type = "Core", elementType =
"rewritePolicy", printObject = true)
public class MapRewritePolicy implements RewritePolicy {
@@ -48,6 +48,12 @@ public class MapRewritePolicy implements
this.mode = mode;
}
+ /**
+ * Rewrite the event.
+ * @param source a logging event that may be returned or
+ * used to create a new logging event.
+ * @return The LogEvent after rewriting.
+ */
public LogEvent rewrite(LogEvent source) {
Message msg = source.getMessage();
if (msg == null || !(msg instanceof MapMessage)) {
@@ -75,6 +81,10 @@ public class MapRewritePolicy implements
source.getSource(), source.getMillis());
}
+ /**
+ * An enumeration to identify whether keys not in the MapMessage should be
added or whether only existing
+ * keys should be updated.
+ */
public enum Mode {
Add, Update
}
@@ -95,6 +105,12 @@ public class MapRewritePolicy implements
return sb.toString();
}
+ /**
+ * The factory method to create the MapRewritePolicy.
+ * @param mode The string representation of the Mode.
+ * @param pairs key/value pairs for the new Map keys and values.
+ * @return The MapRewritePolicy.
+ */
@PluginFactory
public static MapRewritePolicy createPolicy(@PluginAttr("mode") String
mode,
@PluginElement("KeyValuePair")
KeyValuePair[] pairs) {