Package com.adaptris.core.transform.json
Class MetadataToJsonService
java.lang.Object
com.adaptris.core.ServiceImp
com.adaptris.core.transform.json.MetadataToJsonService
- All Implemented Interfaces:
AdaptrisComponent
,ComponentLifecycle
,ComponentLifecycleExtension
,ConfigComment
,MessageEventGenerator
,Service
,StateManagedComponent
@ComponentProfile(summary="Convert metadata values to a JSON object that will be set as the payload of the message")
public class MetadataToJsonService
extends ServiceImp
Convert all metadata values to a JSON object in the message payload.
-
Field Summary
Fields inherited from class com.adaptris.core.ServiceImp
log
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected void
void
doService
(AdaptrisMessage msg) protected void
void
prepare()
void
Add a trailing new line to the payload.void
setConvertNumeric
(Boolean convertNumeric) Make an attempt to convert numerics into their number form rather than leaving as strings.void
setMetadataFilter
(MetadataFilter metadataFilter) Set the metadata filter to be used when generating keys for the JSON payload.withAddTrailingNewline
(boolean b) withConvertNumeric
(boolean convertNumerics) withMetadataFilter
(MetadataFilter metadataFilter) Methods inherited from class com.adaptris.core.ServiceImp
changeState, close, continueOnFailure, createName, createQualifier, getComments, getContinueOnFail, getIsTrackingEndpoint, getUniqueId, init, isBranching, isTrackingEndpoint, requestClose, requestInit, requestStart, requestStop, retrieveComponentState, setComments, setContinueOnFail, setIsTrackingEndpoint, setUniqueId, start, stop
-
Constructor Details
-
MetadataToJsonService
public MetadataToJsonService()
-
-
Method Details
-
doService
- Throws:
ServiceException
-
prepare
- Throws:
CoreException
-
initService
- Specified by:
initService
in classServiceImp
- Throws:
CoreException
-
closeService
protected void closeService()- Specified by:
closeService
in classServiceImp
-
setConvertNumeric
Make an attempt to convert numerics into their number form rather than leaving as strings. -
getConvertNumeric
-
withConvertNumeric
-
getMetadataFilter
-
setMetadataFilter
Set the metadata filter to be used when generating keys for the JSON payload.- Parameters:
metadataFilter
- the filter, default isNoOpMetadataFilter
if not specified.
-
withMetadataFilter
-
setAddTrailingNewline
Add a trailing new line to the payload.The JSON object is emitted without beautification; this allows you to add a new line to the end of the JSON object if this is required. The newline will be platform dependent c.f.
System.lineSeparator()
.- Parameters:
b
- true to add a trailing new line, default isfalse
if not otherwise specified.
-
getAddTrailingNewline
-
withAddTrailingNewline
-