Package org.apache.camel.support.builder
Class TokenPairExpressionIterator
- java.lang.Object
-
- org.apache.camel.support.ExpressionSupport
-
- org.apache.camel.support.ExpressionAdapter
-
- org.apache.camel.support.builder.TokenPairExpressionIterator
-
- All Implemented Interfaces:
org.apache.camel.Expression
,org.apache.camel.Predicate
public class TokenPairExpressionIterator extends ExpressionAdapter
Expression
to walk aMessage
body using anIterator
, which grabs the content between a start and end token. The message body must be able to convert toInputStream
type which is used as stream to access the message body. For splitting XML files useTokenXMLExpressionIterator
instead.
-
-
Field Summary
Fields Modifier and Type Field Description protected String
endToken
protected boolean
includeTokens
protected String
startToken
-
Constructor Summary
Constructors Constructor Description TokenPairExpressionIterator(String startToken, String endToken, boolean includeTokens)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected Iterator<?>
createIterator(org.apache.camel.Exchange exchange, InputStream in, String charset)
Strategy to create the iteratorprotected Object
doEvaluate(org.apache.camel.Exchange exchange, boolean closeStream)
Strategy to evaluate the exchangeObject
evaluate(org.apache.camel.Exchange exchange)
void
init(org.apache.camel.CamelContext context)
boolean
matches(org.apache.camel.Exchange exchange)
String
toString()
-
Methods inherited from class org.apache.camel.support.ExpressionAdapter
assertionFailureMessage, evaluate
-
Methods inherited from class org.apache.camel.support.ExpressionSupport
assertMatches
-
-
-
-
Method Detail
-
init
public void init(org.apache.camel.CamelContext context)
- Specified by:
init
in interfaceorg.apache.camel.Expression
- Specified by:
init
in interfaceorg.apache.camel.Predicate
- Overrides:
init
in classExpressionAdapter
-
matches
public boolean matches(org.apache.camel.Exchange exchange)
- Specified by:
matches
in interfaceorg.apache.camel.Predicate
- Overrides:
matches
in classExpressionSupport
-
evaluate
public Object evaluate(org.apache.camel.Exchange exchange)
- Overrides:
evaluate
in classExpressionSupport
-
doEvaluate
protected Object doEvaluate(org.apache.camel.Exchange exchange, boolean closeStream)
Strategy to evaluate the exchange- Parameters:
exchange
- the exchangecloseStream
- whether to close the stream before returning from this method.- Returns:
- the evaluated value
-
createIterator
protected Iterator<?> createIterator(org.apache.camel.Exchange exchange, InputStream in, String charset)
Strategy to create the iterator- Parameters:
exchange
- the exchangein
- input stream to iteratecharset
- charset- Returns:
- the iterator
-
-