public class CharacterEscapesJsonFactoryDecorator extends Object implements JsonFactoryDecorator
JsonFactoryDecorator that can be used to customize the JsonFactory.setCharacterEscapes(CharacterEscapes).
For example, you could change the escape sequence used for newline characters from '\n' to '
'| Modifier and Type | Class and Description |
|---|---|
static class |
CharacterEscapesJsonFactoryDecorator.Escape
Defines how a character will be escaped whenever that character is attempted to be written by a JsonGenerator.
|
| Constructor and Description |
|---|
CharacterEscapesJsonFactoryDecorator() |
| Modifier and Type | Method and Description |
|---|---|
void |
addEscape(CharacterEscapesJsonFactoryDecorator.Escape escape) |
com.fasterxml.jackson.core.JsonFactory |
decorate(com.fasterxml.jackson.core.JsonFactory factory)
Decorates the given
JsonFactory. |
com.fasterxml.jackson.databind.MappingJsonFactory |
decorate(com.fasterxml.jackson.databind.MappingJsonFactory factory)
Deprecated.
|
boolean |
isIncludeStandardAsciiEscapesForJSON() |
void |
removeEscape(CharacterEscapesJsonFactoryDecorator.Escape escape) |
void |
setIncludeStandardAsciiEscapesForJSON(boolean includeStandardAsciiEscapesForJSON) |
public CharacterEscapesJsonFactoryDecorator()
@Deprecated public com.fasterxml.jackson.databind.MappingJsonFactory decorate(com.fasterxml.jackson.databind.MappingJsonFactory factory)
JsonFactoryDecoratorMappingJsonFactory.
By default, returns the given factory unchanged.decorate in interface JsonFactoryDecoratorpublic com.fasterxml.jackson.core.JsonFactory decorate(com.fasterxml.jackson.core.JsonFactory factory)
JsonFactoryDecoratorJsonFactory.
By default, for backwards compatibility purposes,
this assumes the given factory is a MappingJsonFactory,
and calls JsonFactoryDecorator.decorate(MappingJsonFactory) so that existing
implementations that only implemented JsonFactoryDecorator.decorate(MappingJsonFactory) continue to work.
In a future release, this will be changed to return the given factory by default,
and JsonFactoryDecorator.decorate(MappingJsonFactory) will be removed.
It is recommended to only override JsonFactoryDecorator.decorate(JsonFactory).
Existing implementations should migrate to only overriding JsonFactoryDecorator.decorate(JsonFactory)
so that they will continue to work after JsonFactoryDecorator.decorate(MappingJsonFactory) is removed.
Note that the default JsonFactory created by logstash-logback-encoder
is a MappingJsonFactory, but can be changed by JsonFactoryDecorators
to any subclass of JsonFactory.decorate in interface JsonFactoryDecoratorJsonFactorypublic boolean isIncludeStandardAsciiEscapesForJSON()
public void setIncludeStandardAsciiEscapesForJSON(boolean includeStandardAsciiEscapesForJSON)
public void addEscape(CharacterEscapesJsonFactoryDecorator.Escape escape)
public void removeEscape(CharacterEscapesJsonFactoryDecorator.Escape escape)
Copyright © 2019. All rights reserved.