Class SplitByMetadata

  • All Implemented Interfaces:
    MessageSplitter

    public class SplitByMetadata
    extends MessageCopier

    Implementation of MessageSplitter which allows a single AdaptrisMessage that contains a metadata key that is considered to contain multiple elements to be split.

    In the adapter configuration file this class is aliased as split-by-metadata which is the preferred alternative to the fully qualified classname when building your configuration.

    • Constructor Detail

      • SplitByMetadata

        public SplitByMetadata()
      • SplitByMetadata

        public SplitByMetadata​(java.lang.String metadataKey,
                               java.lang.String splitMetadataKey)
    • Method Detail

      • splitMessage

        public java.lang.Iterable<AdaptrisMessage> splitMessage​(AdaptrisMessage msg)
                                                         throws CoreException
        Description copied from interface: MessageSplitter

        Splits an AdaptrisMessage into some number of AdaptrisMessage objects. Preservation of metadata is down to the implementation.

        If this method returns a CloseableIterable, it must be closed by the caller! This contract cannot be clearly expressed in Java code without breaking the API in uncomfortable ways for things just returning a List, which is why this method is only declared to return Iterable.

        Parameters:
        msg - the msg to split
        Returns:
        an Iterable of AdaptrisMessage
        Throws:
        CoreException - wrapping any other exception
      • getSeparator

        public java.lang.String getSeparator()
        Returns:
        the splitToken
      • setSeparator

        public void setSeparator​(java.lang.String splitToken)
        Parameters:
        splitToken - the splitToken to set
      • getMetadataKey

        public java.lang.String getMetadataKey()
        Returns:
        the metadataKey
      • setMetadataKey

        public void setMetadataKey​(java.lang.String s)
        Parameters:
        s - the metadataKey to derive splis from.
      • getSplitMetadataKey

        public java.lang.String getSplitMetadataKey()
        Returns:
        the splitMetadataKey
      • setSplitMetadataKey

        public void setSplitMetadataKey​(java.lang.String s)
        The metadata key where the split value from setMetadataKey(String) will be stored.
        Parameters:
        s - the splitMetadataKey to set