@Plugin(name="MapRewritePolicy", category="Core", elementType="rewritePolicy", printObject=true) public final class MapRewritePolicy extends java.lang.Object implements RewritePolicy
Modifier and Type | Class and Description |
---|---|
static class |
MapRewritePolicy.Mode
An enumeration to identify whether keys not in the MapMessage should be added or whether only existing
keys should be updated.
|
Modifier and Type | Field and Description |
---|---|
protected static Logger |
LOGGER
Allow subclasses access to the status logger without creating another instance.
|
private java.util.Map<java.lang.String,java.lang.String> |
map |
private MapRewritePolicy.Mode |
mode |
Modifier | Constructor and Description |
---|---|
private |
MapRewritePolicy(java.util.Map<java.lang.String,java.lang.String> map,
MapRewritePolicy.Mode mode) |
Modifier and Type | Method and Description |
---|---|
static MapRewritePolicy |
createPolicy(java.lang.String mode,
KeyValuePair[] pairs)
The factory method to create the MapRewritePolicy.
|
LogEvent |
rewrite(LogEvent source)
Rewrite the event.
|
java.lang.String |
toString() |
protected static final Logger LOGGER
private final java.util.Map<java.lang.String,java.lang.String> map
private final MapRewritePolicy.Mode mode
private MapRewritePolicy(java.util.Map<java.lang.String,java.lang.String> map, MapRewritePolicy.Mode mode)
public LogEvent rewrite(LogEvent source)
rewrite
in interface RewritePolicy
source
- a logging event that may be returned or
used to create a new logging event.public java.lang.String toString()
toString
in class java.lang.Object
@PluginFactory public static MapRewritePolicy createPolicy(@PluginAttribute(value="mode") java.lang.String mode, @PluginElement(value="KeyValuePair") KeyValuePair[] pairs)
mode
- The string representation of the Mode.pairs
- key/value pairs for the new Map keys and values.