Event - - type of the event (ILoggingEvent, IAccessEvent)public abstract class AbstractJsonPatternParser<Event> extends Object
| Modifier and Type | Class and Description |
|---|---|
protected static class |
AbstractJsonPatternParser.ArrayWriter<Event> |
protected static class |
AbstractJsonPatternParser.AsBooleanOperation |
protected static class |
AbstractJsonPatternParser.AsDoubleOperation |
protected class |
AbstractJsonPatternParser.AsJsonOperation |
protected static class |
AbstractJsonPatternParser.AsLongOperation |
static class |
AbstractJsonPatternParser.JsonPatternException |
protected static class |
AbstractJsonPatternParser.LayoutValueGetter<Event> |
protected static class |
AbstractJsonPatternParser.ObjectWriter<Event> |
protected static interface |
AbstractJsonPatternParser.Operation<T> |
protected class |
AbstractJsonPatternParser.TryJsonOperation |
protected static class |
AbstractJsonPatternParser.ValueWriter<Event> |
| Modifier and Type | Field and Description |
|---|---|
static Pattern |
OPERATION_PATTERN
Pattern used to parse and detect
AbstractJsonPatternParser.Operation in a string. |
| Modifier and Type | Method and Description |
|---|---|
protected void |
addOperation(String name,
AbstractJsonPatternParser.Operation<?> operation)
Register a new
AbstractJsonPatternParser.Operation and bind it to the given name. |
protected PatternLayoutAdapter<Event> |
buildLayout(String format)
Initialize a PatternLayout with the supplied format and throw an
IllegalArgumentException
if the format is invalid. |
protected abstract PatternLayoutBase<Event> |
createLayout()
Create a PatternLayout instance of the appropriate type.
|
boolean |
isOmitEmptyFields()
When
true, fields whose values are considered empty will be omitted from JSON output. |
protected ValueGetter<Event,String> |
makeLayoutValueGetter(String data) |
NodeWriter<Event> |
parse(String pattern)
Parse a JSON pattern and produce the corresponding
NodeWriter. |
void |
setOmitEmptyFields(boolean omitEmptyFields)
When
true, fields whose values are considered empty will be omitted from JSON output. |
public static final Pattern OPERATION_PATTERN
AbstractJsonPatternParser.Operation in a string.
An operation starts with a #, followed by a name and a pair of {} with possible arguments in between.protected void addOperation(String name, AbstractJsonPatternParser.Operation<?> operation)
AbstractJsonPatternParser.Operation and bind it to the given name.name - the name of the operationoperation - the AbstractJsonPatternParser.Operation instanceprotected ValueGetter<Event,String> makeLayoutValueGetter(String data)
protected PatternLayoutAdapter<Event> buildLayout(String format)
IllegalArgumentException
if the format is invalid.format - the pattern layout formatPatternLayoutAdapter instance around the supplied formatIllegalArgumentException - if the supplied format is not a valid PatternLayoutprotected abstract PatternLayoutBase<Event> createLayout()
PatternLayoutBase instancepublic NodeWriter<Event> parse(String pattern) throws AbstractJsonPatternParser.JsonPatternException
NodeWriter.
Returns null if the pattern is invalid, null or empty. An error status is
logged when the pattern is invalid and parsing failed.pattern - the JSON pattern to parseNodeWriter configured according to the patternAbstractJsonPatternParser.JsonPatternException - denotes an invalid patternpublic boolean isOmitEmptyFields()
true, fields whose values are considered empty will be omitted from JSON output.true if fields with empty values are omitted from JSON outputpublic void setOmitEmptyFields(boolean omitEmptyFields)
true, fields whose values are considered empty will be omitted from JSON output.omitEmptyFields - whether fields with empty value should be omitted or notCopyright © 2013–2021. All rights reserved.