org.apache.camel.model.language.ExpressionDefinition Java Examples
The following examples show how to use
org.apache.camel.model.language.ExpressionDefinition.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: LoadBalanceStepParser.java From camel-k-runtime with Apache License 2.0 | 5 votes |
@Override public ExpressionDefinition getExpression() { final ExpressionSubElementDefinition expression = super.getCorrelationExpression(); return expression != null ? super.getCorrelationExpression().getExpressionType() : null; }
Example #2
Source File: AggregateStepParser.java From camel-k-runtime with Apache License 2.0 | 4 votes |
@Override public ExpressionDefinition getExpression() { return super.getExpressionType(); }
Example #3
Source File: Expressions.java From fabric8-forge with Apache License 2.0 | 4 votes |
public static String getExpressionOrElse(ExpressionDefinition exp, String defaultValue) { if (exp != null) { return Strings2.getOrElse(exp.getExpression(), defaultValue).trim(); } return defaultValue; }
Example #4
Source File: Expressions.java From fabric8-forge with Apache License 2.0 | 4 votes |
public static String getExpressionOrElse(ExpressionDefinition exp) { return getExpressionOrElse(exp, ""); }
Example #5
Source File: CamelEditNodeXmlCommand.java From fabric8-forge with Apache License 2.0 | 4 votes |
private void expressionOptions(String k, ExpressionDefinition exp, Map<String, String> options) { // special for aggregate as it has naming clash if ("completionSizeExpression".equals(k)) { k = "completionSize"; } else if ("completionTimeoutExpression".equals(k)) { k = "completionTimeout"; } String text = exp.getExpression(); String lan = exp.getLanguage(); options.put(k, lan); if (text != null) { options.put(k + "_value", text); } // when using a language as an expression it can contain additional options which we // cannot build a nice UI in forge as forge is not that dynamic. So instead we have an extra // input field where we allow users to edit the values using a Camel multivalue uri style with // key=value&key2=value2 ... CollectionStringBuffer csb = new CollectionStringBuffer("&"); String json = getCamelCatalog().languageJSonSchema(lan); if (json != null) { List<Map<String, String>> data = JSonSchemaHelper.parseJsonSchema("properties", json, true); if (data != null) { for (Map<String, String> map : data) { String name = map.get("name"); // skip expression/id as we are not interested in those if (name != null && !"id".equals(name) && !"expression".equals(name)) { try { Object value = IntrospectionSupport.getProperty(exp, name); if (value != null) { text = value.toString(); csb.append(name + "=" + text); } } catch (Exception e) { // ignore } } } } if (!csb.isEmpty()) { String extra = csb.toString(); options.put(k + "_extra", extra); } } }
Example #6
Source File: GenerateYamlParserSupportClasses.java From camel-k-runtime with Apache License 2.0 | 4 votes |
public final TypeSpec generateHasExpression() { TypeSpec.Builder type = TypeSpec.interfaceBuilder("HasExpression"); type.addModifiers(Modifier.PUBLIC); type.addMethod( MethodSpec.methodBuilder("setExpression") .addModifiers(Modifier.PUBLIC, Modifier.ABSTRACT) .addParameter(ExpressionDefinition.class, "expressionDefinition") .addAnnotation( AnnotationSpec.builder(JsonTypeInfo.class) .addMember("use", "$L", "JsonTypeInfo.Id.NAME") .addMember("include", "$L", "JsonTypeInfo.As.WRAPPER_OBJECT") .build()) .build() ); type.addMethod( MethodSpec.methodBuilder("getExpression") .addModifiers(Modifier.PUBLIC, Modifier.ABSTRACT) .returns(ExpressionDefinition.class) .build() ); definitions(EXPRESSION_DEFINITION_CLASS).forEach( (k, v) -> { String name = k; name = WordUtils.capitalize(name, '_', '-'); name = StringUtils.remove(name, "_"); name = StringUtils.remove(name, "-"); type.addMethod(MethodSpec.methodBuilder("set" + name) .addAnnotation( AnnotationSpec.builder(JsonAlias.class).addMember("value", "$S", k).build()) .addModifiers(Modifier.PUBLIC, Modifier.DEFAULT) .addParameter(v, "definition") .addCode( CodeBlock.builder() .beginControlFlow("if (getExpression() != null)") .addStatement("throw new IllegalArgumentException(\"And expression has already been set\")") .endControlFlow() .addStatement("setExpression(definition);").build()) .build() ); } ); return type.build(); }
Example #7
Source File: ServiceCallStepParser.java From camel-k-runtime with Apache License 2.0 | 4 votes |
@Override public ExpressionDefinition getExpression() { return super.getExpressionType(); }
Example #8
Source File: ServiceCallStepParser.java From camel-k-runtime with Apache License 2.0 | 4 votes |
@Override public void setExpression(ExpressionDefinition expressionDefinition) { super.setExpressionType(expressionDefinition); }
Example #9
Source File: ServiceCallStepParser.java From camel-k-runtime with Apache License 2.0 | 4 votes |
@JsonIgnore @Override public void setExpressionType(ExpressionDefinition expressionType) { super.setExpressionType(expressionType); }
Example #10
Source File: ServiceCallStepParser.java From camel-k-runtime with Apache License 2.0 | 4 votes |
@JsonIgnore @Override public ExpressionDefinition getExpressionType() { return super.getExpressionType(); }
Example #11
Source File: ServiceCallStepParser.java From camel-k-runtime with Apache License 2.0 | 4 votes |
@Override public ExpressionDefinition getExpression() { return delegate.getExpression() != null ? new ExpressionDefinition(delegate.getExpression()) : null; }
Example #12
Source File: ServiceCallStepParser.java From camel-k-runtime with Apache License 2.0 | 4 votes |
@Override public void setExpression(ExpressionDefinition expressionDefinition) { delegate.setExpression(expressionDefinition); }
Example #13
Source File: FastCamelContext.java From camel-quarkus with Apache License 2.0 | 4 votes |
@Override public Expression createExpression(ExpressionDefinition definition) { return ExpressionReifier.reifier(this, definition).createExpression(); }
Example #14
Source File: AggregateStepParser.java From camel-k-runtime with Apache License 2.0 | 4 votes |
@Override public void setExpression(ExpressionDefinition expressionDefinition) { super.setExpressionType(expressionDefinition); }
Example #15
Source File: WireTapStepParser.java From camel-k-runtime with Apache License 2.0 | 4 votes |
@Override public ExpressionDefinition getExpression() { return super.getExpressionType(); }
Example #16
Source File: WireTapStepParser.java From camel-k-runtime with Apache License 2.0 | 4 votes |
@Override public void setExpression(ExpressionDefinition expressionDefinition) { super.setExpressionType(expressionDefinition); }
Example #17
Source File: LoadBalanceStepParser.java From camel-k-runtime with Apache License 2.0 | 4 votes |
@Override public void setExpression(ExpressionDefinition expressionDefinition) { super.setCorrelationExpression(expressionDefinition); }
Example #18
Source File: OnExceptionStepParser.java From camel-k-runtime with Apache License 2.0 | 4 votes |
@Override public ExpressionDefinition getExpression() { return super.getExpressionType(); }
Example #19
Source File: OnExceptionStepParser.java From camel-k-runtime with Apache License 2.0 | 4 votes |
@Override public void setExpression(ExpressionDefinition expressionDefinition) { super.setExpressionType(expressionDefinition); }
Example #20
Source File: OnExceptionStepParser.java From camel-k-runtime with Apache License 2.0 | 4 votes |
@Override public ExpressionDefinition getExpression() { return super.getExpressionType(); }
Example #21
Source File: OnExceptionStepParser.java From camel-k-runtime with Apache License 2.0 | 4 votes |
@Override public void setExpression(ExpressionDefinition expressionDefinition) { super.setExpressionType(expressionDefinition); }
Example #22
Source File: FastCamelContext.java From camel-quarkus with Apache License 2.0 | 4 votes |
@Override public Predicate createPredicate(ExpressionDefinition definition) { return ExpressionReifier.reifier(this, definition).createPredicate(); }