public class SimpleRegexpMessageSplitter extends StringPayloadSplitter
Class which splits batched files in a singel AdaptrisMessage
into individual ones based on a regular expression
match. It will optionally group records according to some common element, for example a Purchase Order number.
In the adapter configuration file this class is aliased as simple-regexp-message-splitter which is the preferred alternative to the fully qualified classname when building your configuration.
MessageSplitterImp.SplitMessageIterator
logR
Constructor and Description |
---|
SimpleRegexpMessageSplitter() |
SimpleRegexpMessageSplitter(java.lang.String pattern) |
Modifier and Type | Method and Description |
---|---|
boolean |
compareToPreviousMatch() |
java.lang.Boolean |
getCompareToPreviousMatch()
Returns whether this splitter will group matched records together.
|
java.lang.Boolean |
getIgnoreFirstSubMessage()
Returns whether this splitter will ignore the first record or not.
|
java.lang.String |
getMatchPattern()
Gets the regular expression to group records on.
|
java.lang.String |
getSplitPattern()
Gets the regular expression to split on.
|
boolean |
ignoreFirstSubMessage() |
void |
setCompareToPreviousMatch(java.lang.Boolean b)
Specify whether to group split records or not
|
void |
setIgnoreFirstSubMessage(java.lang.Boolean b)
Specifies whether to omit the first record parsed, to avoid creating empty records if the split pattern matches on the
beginning of a new message rather than the end of the old one.
|
void |
setMatchPattern(java.lang.String pattern)
Sets the regular expression to group records on.
|
void |
setSplitPattern(java.lang.String pattern)
Sets the regular expression to split on.
|
protected java.util.ArrayList<java.lang.String> |
split(java.lang.String messagePayload)
default split operation.
|
splitMessage
copyMetadata, getCopyMetadata, getCopyObjectMetadata, getMessageFactory, selectFactory, setCopyMetadata, setCopyObjectMetadata, setMessageFactory
public SimpleRegexpMessageSplitter()
public SimpleRegexpMessageSplitter(java.lang.String pattern)
protected java.util.ArrayList<java.lang.String> split(java.lang.String messagePayload) throws java.lang.Exception
StringPayloadSplitter
split
in class StringPayloadSplitter
messagePayload
- the string payload derived from the AdaptrisMessage
java.lang.Exception
public void setSplitPattern(java.lang.String pattern)
Sets the regular expression to split on. Examples include:
pattern
- the split patternpublic java.lang.String getSplitPattern()
Gets the regular expression to split on.
public void setMatchPattern(java.lang.String pattern)
Sets the regular expression to group records on. Must contain a backreference which will contain the actual text to be compared. Examples include:
pattern
- the match patternpublic java.lang.String getMatchPattern()
Gets the regular expression to group records on.
public void setCompareToPreviousMatch(java.lang.Boolean b)
Records identified by the split pattern which would normally be output into separate messages will instead be grouped into compound messages if the value extracted by the specified match pattern is the same across them. The splitter will only match against the record which was separated out immediately before this one.
b
- whether to group split records or not, default falsepublic java.lang.Boolean getCompareToPreviousMatch()
Returns whether this splitter will group matched records together.
public boolean compareToPreviousMatch()
public void setIgnoreFirstSubMessage(java.lang.Boolean b)
Specifies whether to omit the first record parsed, to avoid creating empty records if the split pattern matches on the beginning of a new message rather than the end of the old one.
b
- whether to omit the first record parsed, default falsepublic java.lang.Boolean getIgnoreFirstSubMessage()
Returns whether this splitter will ignore the first record or not.
public boolean ignoreFirstSubMessage()