|
Platform SDK Java 8.5 API Reference | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.genesyslab.platform.commons.collections.processor.KeyValueAbstractOutputFilter
public abstract class KeyValueAbstractOutputFilter
"Base" implementation of KeyValueOutputFilter interface. Default behavior of this class is to print everything.
KeyValuePrinter
Constructor Summary | |
---|---|
KeyValueAbstractOutputFilter()
|
Method Summary | |
---|---|
java.lang.String |
appendKeyValuePair(java.lang.StringBuffer buf,
java.lang.String key,
java.lang.Object value,
KeyValuePrinterContext context)
"Entry point" method for key-value pair output. |
void |
configure(KeyValueCollection options)
Configuration for filter. |
protected java.lang.String |
doAppendKeyValuePair(java.lang.StringBuffer buf,
java.lang.String key,
java.lang.Object value,
KeyValuePrinterContext context)
Default implementation of key-value pair output. |
protected void |
doAppendPairKey(java.lang.StringBuffer buf,
java.lang.String key,
java.lang.Object value,
KeyValuePrinterContext context)
Default implementation of pair key output. |
protected void |
doAppendPairKeyType(java.lang.StringBuffer buf,
java.lang.String key,
java.lang.Object value,
KeyValuePrinterContext context)
Default implementation of pair key type mark output. |
protected java.lang.String |
doAppendPairValue(java.lang.StringBuffer buf,
java.lang.String key,
java.lang.Object value,
KeyValuePrinterContext context)
Default implementation of value output function. |
boolean |
isFilteredOut(java.lang.String key,
java.lang.Object value,
KeyValuePrinterContext context)
Evaluates that some key-value pair should be skipped on log print or not. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public KeyValueAbstractOutputFilter()
Method Detail |
---|
public void configure(KeyValueCollection options)
configure
in interface KeyValueOutputFilter
options
- Collection with configuration datapublic boolean isFilteredOut(java.lang.String key, java.lang.Object value, KeyValuePrinterContext context)
if (! isFilteredOut(key, value, context)) {
String rest = appendKeyValuePair(
buffer, key, value, context
);
if (rest != null) {
buffer.append(rest);
}
}
isFilteredOut
in interface KeyValueOutputFilter
key
- Pair string keyvalue
- Pair valuecontext
- Printer context
public java.lang.String appendKeyValuePair(java.lang.StringBuffer buf, java.lang.String key, java.lang.Object value, KeyValuePrinterContext context)
isFilteredOut(...)
.
This default implementation of the interface method performs
following operations:
- doAppendKeyValuePair() = doAppendPairKey() + " = " + doAppendPairValue()
-- doAppendPairKey() = "'" + <key> + "'" + doAppendPairKeyType()
--- doAppendPairKeyType() = " [int]" || " [str]" || " [bstr]" || " [lst]" || ...
-- doAppendPairValue() = <int-value> || "<str-value>" || ...
So, if it is required to have some filter to hide passwords or part of credit card numbers,
to truncate long binary data, or unpack some structures, etc, it is enough to override
doAppendPairValue()
and perform appropriate value output.
Output of inner KeyValueCollection lists is a special case.
This method does not print it recursively. Inner lists are handled outside.
It outputs some prefix and, optionally, returns some value for delayed output.
Returned value will be appended right after inner list filtering.
appendKeyValuePair
in interface KeyValueOutputFilter
buf
- Output bufferkey
- Pair string keyvalue
- Pair valuecontext
- Printer context
isFilteredOut(String, Object, KeyValuePrinterContext)
protected java.lang.String doAppendKeyValuePair(java.lang.StringBuffer buf, java.lang.String key, java.lang.Object value, KeyValuePrinterContext context)
appendKeyValuePair()
right after indentation, and by default it outputs following components:
doAppendPairKey() + " = " + doAppendPairValue()
buf
- Output bufferkey
- Pair string keyvalue
- Pair valuecontext
- Printer context
appendKeyValuePair(StringBuffer, String, Object, KeyValuePrinterContext)
,
doAppendPairKey(StringBuffer, String, Object, KeyValuePrinterContext)
,
doAppendPairValue(StringBuffer, String, Object, KeyValuePrinterContext)
protected void doAppendPairKey(java.lang.StringBuffer buf, java.lang.String key, java.lang.Object value, KeyValuePrinterContext context)
doAppendKeyValuePair()
,
and by default it outputs following components:
"'" + <key> + "'" + doAppendPairKeyType()
buf
- Output bufferkey
- Pair string keyvalue
- Pair valuecontext
- Printer contextdoAppendKeyValuePair(StringBuffer, String, Object, KeyValuePrinterContext)
,
doAppendPairKeyType(StringBuffer, String, Object, KeyValuePrinterContext)
protected void doAppendPairKeyType(java.lang.StringBuffer buf, java.lang.String key, java.lang.Object value, KeyValuePrinterContext context)
doAppendKeyValuePair()
,
and by default if value is not null it outputs following values depending on value type:
" [int]" || " [str]" || " [bstr]" || " [lst]" || ...
buf
- Output bufferkey
- Pair string keyvalue
- Pair valuecontext
- Printer contextdoAppendPairKey(StringBuffer, String, Object, KeyValuePrinterContext)
protected java.lang.String doAppendPairValue(java.lang.StringBuffer buf, java.lang.String key, java.lang.Object value, KeyValuePrinterContext context)
buf
- Output bufferkey
- Pair string keyvalue
- Pair valuecontext
- Printer context
Hex.appendBytesStr(StringBuffer, byte[], boolean, int)
|
Platform SDK Java 8.5 API Reference | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |