public class GlobalCustomFieldsJsonProvider<Event extends DeferredProcessingAware> extends AbstractJsonProvider<Event> implements JsonFactoryAware
context| Constructor and Description |
|---|
GlobalCustomFieldsJsonProvider() |
| Modifier and Type | Method and Description |
|---|---|
String |
getCustomFields() |
ObjectNode |
getCustomFieldsNode() |
void |
setCustomFields(String customFields)
Set the custom fields as a JSON string.
|
void |
setCustomFieldsNode(JsonNode customFields)
Deprecated.
use
setCustomFieldsNode(ObjectNode) instead. |
void |
setCustomFieldsNode(ObjectNode customFields)
Use the fields of the given
ObjectNode (may be empty). |
void |
setJsonFactory(JsonFactory jsonFactory) |
void |
start()
Start the provider.
|
void |
writeTo(JsonGenerator generator,
Event event)
Writes information about the event, to the given generator.
|
isStarted, prepareForDeferredProcessing, stopaddError, addError, addInfo, addInfo, addStatus, addWarn, addWarn, getContext, getDeclaredOrigin, getStatusManager, setContextclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitaddError, addError, addInfo, addInfo, addStatus, addWarn, addWarn, getContext, setContextpublic void writeTo(JsonGenerator generator, Event event) throws IOException
JsonProviderWhen called, the generator is assumed to be within a JSON object context (i.e. this provider should write fields and their values to the generator). Upon return, the generator should be within the same JSON object context.
writeTo in interface JsonProvider<Event extends DeferredProcessingAware>generator - the JsonGenerator to produce JSON contentevent - the event to convert into JSONIOException - if an I/O error occurspublic void start()
The provider is started even when it fails to parse the customFields JSON string.
An ERROR status is emitted instead and no exception is thrown.
start in interface JsonProvider<Event extends DeferredProcessingAware>start in class AbstractJsonProvider<Event extends DeferredProcessingAware>public void setCustomFields(String customFields)
start().customFields - the custom fields as JSON string.public String getCustomFields()
public ObjectNode getCustomFieldsNode()
@Deprecated public void setCustomFieldsNode(JsonNode customFields)
setCustomFieldsNode(ObjectNode) instead.ObjectNode.customFields - a JsonNode whose properties must be added as custom fields.IllegalArgumentException - if the argument is not a ObjectNode.public void setCustomFieldsNode(ObjectNode customFields)
ObjectNode (may be empty).customFields - the JSON object whose fields as added as custom fieldspublic void setJsonFactory(JsonFactory jsonFactory)
setJsonFactory in interface JsonFactoryAwareCopyright © 2013–2021. All rights reserved.