public void setKey(String key) { this.key = ExpressionBuilder.constantExpression(key); }
protected Expression createProducerExpression() { final Class<?> type = getEntityType(); if (type == null) { return ExpressionBuilder.bodyExpression(); } else { return new Expression() { public Object evaluate(Exchange exchange, Class asType) { Object answer = exchange.getIn().getBody(type); if (answer == null) { Object defaultValue = exchange.getIn().getBody(); if (defaultValue != null) { throw ObjectHelper.wrapRuntimeCamelException(new NoTypeConversionAvailableException(defaultValue, type)); } // if we don't have a body then // lets instantiate and inject a new instance answer = exchange.getContext().getInjector().newInstance(type); } return answer; } }; } }
private void parseValueExpression(Token valueSrcToken) { if (SSPTParserConstants.SIMPLE_EXP_TOKEN == valueSrcToken.kind) { final Expression exp = ExpressionBuilder.simpleExpression(valueSrcToken.toString()); this.valueExtractor = (exchange, container) -> exp.evaluate(exchange, Object.class); } else if (SSPTParserConstants.PARAMETER_POS_TOKEN == valueSrcToken.kind) { //remove leading :# final String mapKey = valueSrcToken.toString().substring(2); this.valueExtractor = (exchange, container) -> ((Map) container).get(mapKey); } }
private Expression aggKeyExpression(AggregatorConfig aggregatorConfig) throws Exception { //NOSONAR return beanExpression(aggregatorConfig.getStrategyInstance(), "aggregationKey"); } }
public ProcessorAdapterDefinition header(String name) { return processorAdapterDefinition.params(headerExpression(name)); }
String id = routeIdExpression().evaluate(exchange, String.class); if (id != null) {
/** * Creates a consumer endpoint that splits up the List of Maps into exchanges of single * Maps, and within each exchange it converts each Map to JSON. */ @Override public Consumer createConsumer(final Processor processor) throws Exception { final ToJSONProcessor toJsonProcessor = new ToJSONProcessor(); Processor pipeline = Pipeline.newInstance(getCamelContext(), toJsonProcessor, processor); final Expression expression = ExpressionBuilder.bodyExpression(List.class); final Splitter splitter = new Splitter(getCamelContext(), expression, pipeline, null); return endpoint.createConsumer(splitter); }
private void parseValueExpression(Token valueSrcToken) { if (SSPTParserConstants.SIMPLE_EXP_TOKEN == valueSrcToken.kind) { final Expression exp = ExpressionBuilder.simpleExpression(valueSrcToken.toString()); this.valueExtractor = (exchange, container) -> exp.evaluate(exchange, Object.class); } else if (SSPTParserConstants.PARAMETER_POS_TOKEN == valueSrcToken.kind) { //remove leading :# final String mapKey = valueSrcToken.toString().substring(2); this.valueExtractor = (exchange, container) -> ((Map) container).get(mapKey); } }
protected Expression splitExpression() throws Exception { //NOSONAR return beanExpression(routeConfig.getSplitStrategy(), SplitStrategy.SPLIT_METHOD_NAME); }
public CacheBasedXPathReplacer(String cacheName, String key, String xpath) { this(cacheName, ExpressionBuilder.constantExpression(key), xpath); }
public void setKey(String key) { this.key = ExpressionBuilder.constantExpression(key); }
public CacheBasedMessageBodyReplacer(String cacheName, String key) { this(cacheName, ExpressionBuilder.constantExpression(key)); }
public void setKey(String key) { this.key = ExpressionBuilder.constantExpression(key); }
public CacheBasedTokenReplacer(String cacheName, String key, String replacementToken) { this(cacheName, ExpressionBuilder.constantExpression(key), replacementToken); }
public <T> T evaluate(Exchange exchange, Class<T> type) { return ExpressionBuilder.constantExpression(name()).evaluate(exchange, type); }
.when(isNotEqualTo(header(WonCamelConstants.SUPPRESS_MESSAGE_REACTION), ExpressionBuilder.constantExpression(Boolean.TRUE))) .to("direct:reactToMessage") .otherwise() .to("direct:invokeFacetLogic") .choice() .when(isNotEqualTo(header(WonCamelConstants.SUPPRESS_MESSAGE_TO_OWNER), ExpressionBuilder.constantExpression(Boolean.TRUE))) .to("direct:sendToOwner") .otherwise() .end() .choice() .when(isNotEqualTo(header(WonCamelConstants.SUPPRESS_MESSAGE_REACTION), ExpressionBuilder.constantExpression(Boolean.TRUE))) .to("direct:reactToMessage") .otherwise() .when(isNotEqualTo(header(WonCamelConstants.IGNORE_HINT), ExpressionBuilder.constantExpression(Boolean.TRUE))) .to("direct:reference-sign-persist") .otherwise()