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.
  • Constructor Details

    • MetadataToJsonService

      public MetadataToJsonService()
  • Method Details

    • doService

      public void doService(AdaptrisMessage msg) throws ServiceException
      Throws:
      ServiceException
    • prepare

      public void prepare() throws CoreException
      Throws:
      CoreException
    • initService

      protected void initService() throws CoreException
      Specified by:
      initService in class ServiceImp
      Throws:
      CoreException
    • closeService

      protected void closeService()
      Specified by:
      closeService in class ServiceImp
    • setConvertNumeric

      public void setConvertNumeric(Boolean convertNumeric)
      Make an attempt to convert numerics into their number form rather than leaving as strings.
    • getConvertNumeric

      public Boolean getConvertNumeric()
    • withConvertNumeric

      public MetadataToJsonService withConvertNumeric(boolean convertNumerics)
    • getMetadataFilter

      public MetadataFilter getMetadataFilter()
    • setMetadataFilter

      public void setMetadataFilter(MetadataFilter metadataFilter)
      Set the metadata filter to be used when generating keys for the JSON payload.
      Parameters:
      metadataFilter - the filter, default is NoOpMetadataFilter if not specified.
    • withMetadataFilter

      public MetadataToJsonService withMetadataFilter(MetadataFilter metadataFilter)
    • setAddTrailingNewline

      public void setAddTrailingNewline(Boolean b)
      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 is false if not otherwise specified.
    • getAddTrailingNewline

      public Boolean getAddTrailingNewline()
    • withAddTrailingNewline

      public MetadataToJsonService withAddTrailingNewline(boolean b)