Package org.apache.camel.component.mock
Class MockValueBuilder
java.lang.Object
org.apache.camel.component.mock.MockValueBuilder
- All Implemented Interfaces:
org.apache.camel.Expression,org.apache.camel.Predicate
- Direct Known Subclasses:
AssertionClause.PredicateValueBuilder
public class MockValueBuilder
extends Object
implements org.apache.camel.Expression, org.apache.camel.Predicate
A builder of expressions or predicates based on values.
This implementation is a derived copy of the org.apache.camel.builder.ValueBuilder from camel-core, that are
specialized for being used with the mock component and separated from camel-core.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionAppends the string evaluation of this expression with the given valueprotected org.apache.camel.ExpressionasExpression(Object value) org.apache.camel.PredicateCreate a predicate that the left-hand expression contains the value of the right-hand expressionConverts the current value to the given type using the registered type convertersConverts the current value to a String using the registered type convertersdatasonnet(String value) Creates an expression using the datasonnet languageorg.apache.camel.Predicate<T> Texpression(Function<Object, Object> function) Creates an expression using the custom expressionorg.apache.camel.ExpressionCreates an expression using the groovy languageorg.apache.camel.Predicateorg.apache.camel.Predicatein(org.apache.camel.Predicate... predicates) voidinit(org.apache.camel.CamelContext context) org.apache.camel.Predicateorg.apache.camel.PredicateisEqualToIgnoreCase(Object value) org.apache.camel.PredicateisFalse()org.apache.camel.PredicateisGreaterThan(Object value) org.apache.camel.PredicateisGreaterThanOrEqualTo(Object value) org.apache.camel.PredicateisInstanceOf(Class<?> type) org.apache.camel.PredicateisLessThan(Object value) org.apache.camel.PredicateisLessThanOrEqualTo(Object value) org.apache.camel.PredicateisNotEqualTo(Object value) org.apache.camel.Predicateorg.apache.camel.PredicateisNull()org.apache.camel.PredicateisTrue()Creates an expression using the jq languageCreates an expression using the javascript languageCreates an expression using the jsonpath languageCreates an expression using the given languageMockExpressionClause<org.apache.camel.Predicate> matches()booleanmatches(org.apache.camel.Exchange exchange) org.apache.camel.Predicatematches(org.apache.camel.Expression expression) Creates an expression using the mvel languagenot()Negates the built expression.org.apache.camel.Predicatenot(org.apache.camel.Predicate predicate) Creates an expression using the ognl languageprotected org.apache.camel.PredicateonNewPredicate(org.apache.camel.Predicate predicate) A strategy method to allow derived classes to deal with the newly created predicate in different waysprotected MockValueBuilderonNewValueBuilder(org.apache.camel.Expression exp) Prepends the string evaluation of this expression with the given valueCreates an expression using the python languageorg.apache.camel.PredicateCreates a predicate which is true if this expression matches the given regular expressionregexReplaceAll(String regex, String replacement) Replaces all occurrences of the regular expression with the given replacementregexReplaceAll(String regex, org.apache.camel.Expression replacement) Replaces all occurrences of the regular expression with the given replacementregexTokenize(String regex) Tokenizes the string conversion of this expression using the given regular expressionCreates an expression using the simple languagesort(Comparator<?> comparator) Sorts the current value using the given comparator.Creates an expression using the spel languageorg.apache.camel.PredicatestartsWith(Object value) tokenize()Creates an expression using the tokenize language using new-line as tokenizerCreates an expression using the tokenize languageCreates an expression using the tokenize languageCreates an expression using the tokenize languagetoString()Creates an expression using the xpath languageCreates an expression using the xquery languageMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.apache.camel.Predicate
initPredicate
-
Constructor Details
-
MockValueBuilder
public MockValueBuilder(org.apache.camel.Expression expression)
-
-
Method Details
-
init
public void init(org.apache.camel.CamelContext context) - Specified by:
initin interfaceorg.apache.camel.Expression- Specified by:
initin interfaceorg.apache.camel.Predicate
-
evaluate
- Specified by:
evaluatein interfaceorg.apache.camel.Expression
-
matches
public boolean matches(org.apache.camel.Exchange exchange) - Specified by:
matchesin interfaceorg.apache.camel.Predicate
-
getExpression
public org.apache.camel.Expression getExpression() -
toString
-
matches
public org.apache.camel.Predicate matches(org.apache.camel.Expression expression) -
matches
-
isTrue
public org.apache.camel.Predicate isTrue() -
isFalse
public org.apache.camel.Predicate isFalse() -
isNotEqualTo
-
isEqualTo
-
isEqualToIgnoreCase
-
isLessThan
-
isLessThanOrEqualTo
-
isGreaterThan
-
isGreaterThanOrEqualTo
-
isInstanceOf
-
isNull
public org.apache.camel.Predicate isNull() -
isNotNull
public org.apache.camel.Predicate isNotNull() -
not
public org.apache.camel.Predicate not(org.apache.camel.Predicate predicate) -
in
-
in
public org.apache.camel.Predicate in(org.apache.camel.Predicate... predicates) -
startsWith
-
endsWith
-
contains
Create a predicate that the left-hand expression contains the value of the right-hand expression- Parameters:
value- the element which is compared to be contained within this expression- Returns:
- a predicate which evaluates to true if the given value expression is contained within this expression value
-
regex
Creates a predicate which is true if this expression matches the given regular expression- Parameters:
regex- the regular expression to match- Returns:
- a predicate which evaluates to true if the expression matches the regex
-
expression
Creates an expression using the custom expression- Parameters:
function- the custom function- Returns:
- a builder with the expression
-
language
Creates an expression using the given language- Parameters:
language- the languagevalue- the expression value- Returns:
- a builder with the expression
-
simple
Creates an expression using the simple language- Parameters:
value- the expression value- Returns:
- a builder with the expression
-
datasonnet
Creates an expression using the datasonnet language- Parameters:
value- the expression value- Returns:
- a builder with the expression
-
groovy
Creates an expression using the groovy language- Parameters:
value- the expression value- Returns:
- a builder with the expression
-
js
Creates an expression using the javascript language- Parameters:
value- the expression value- Returns:
- a builder with the expression
-
jq
Creates an expression using the jq language- Parameters:
value- the expression value- Returns:
- a builder with the expression
-
jsonpath
Creates an expression using the jsonpath language- Parameters:
value- the expression value- Returns:
- a builder with the expression
-
mvel
Creates an expression using the mvel language- Parameters:
value- the expression value- Returns:
- a builder with the expression
-
ognl
Creates an expression using the ognl language- Parameters:
value- the expression value- Returns:
- a builder with the expression
-
python
Creates an expression using the python language- Parameters:
value- the expression value- Returns:
- a builder with the expression
-
spel
Creates an expression using the spel language- Parameters:
value- the expression value- Returns:
- a builder with the expression
-
xpath
Creates an expression using the xpath language- Parameters:
value- the expression value- Returns:
- a builder with the expression
-
xquery
Creates an expression using the xquery language- Parameters:
value- the expression value- Returns:
- a builder with the expression
-
tokenize
Creates an expression using the tokenize language using new-line as tokenizer- Returns:
- a builder with the expression
-
tokenize
Creates an expression using the tokenize language- Parameters:
token- the token to use- Returns:
- a builder with the expression
-
tokenize
Creates an expression using the tokenize language- Parameters:
token- the token to usegroup- number of elements to groupskipFirst- whether to skip first element- Returns:
- a builder with the expression
-
tokenize
Creates an expression using the tokenize language- Parameters:
token- the token to usegroup- number of elements to groupskipFirst- whether to skip first element- Returns:
- a builder with the expression
-
regexTokenize
Tokenizes the string conversion of this expression using the given regular expression -
regexReplaceAll
Replaces all occurrences of the regular expression with the given replacement -
regexReplaceAll
Replaces all occurrences of the regular expression with the given replacement -
convertTo
Converts the current value to the given type using the registered type converters- Parameters:
type- the type to convert the value to- Returns:
- the current builder
-
convertToString
Converts the current value to a String using the registered type converters- Returns:
- the current builder
-
append
Appends the string evaluation of this expression with the given value- Parameters:
value- the value or expression to append- Returns:
- the current builder
-
prepend
Prepends the string evaluation of this expression with the given value- Parameters:
value- the value or expression to prepend- Returns:
- the current builder
-
sort
Sorts the current value using the given comparator. The current value must be convertable to aListto allow sorting using the comparator.- Parameters:
comparator- the comparator used by sorting- Returns:
- the current builder
-
not
Negates the built expression.- Returns:
- the current builder
-
onNewPredicate
protected org.apache.camel.Predicate onNewPredicate(org.apache.camel.Predicate predicate) A strategy method to allow derived classes to deal with the newly created predicate in different ways -
asExpression
-
onNewValueBuilder
-