/** * Builds a new expression with the specified attributes * * @return the newly built {@link Expression} * @throws InvalidExpressionException is name or returnType is not set or set to an empty String. * @author Emmanuel Duchastenier * @since 6.0 */ public Expression done() throws InvalidExpressionException { final String returnType = expression.getReturnType(); final String expName = expression.getName(); final String content = expression.getContent(); final String expressionType = expression.getExpressionType(); final List<Expression> dependencies = expression.getDependencies(); generalCheck(returnType, expName, content); if (ExpressionType.TYPE_CONDITION.name().equals(expressionType)) { validateConditionExpression(content, dependencies); } return expression; }
/** * Sets the return type of the underlining expression. * * @param returnType the return type to set on the expression. * @return this ExpressionBuilder itself. * @throws IllegalArgumentException if the return type is a primitive type */ public ExpressionBuilder setReturnType(final String returnType) throws IllegalArgumentException { if (INVALID_PRIMITIVE_TYPES.contains(returnType)) { throw new IllegalArgumentException( "Primitive type " + returnType + " is forbidden in Expression return type"); } expression.setReturnType(returnType); return this; }
public ExpressionBuilder setName(final String name) { expression.setName(name); return this; }
public ExpressionBuilder setDependencies(final List<Expression> dependencies) { expression.setDependencies(dependencies); return this; }
public ExpressionBuilder setInterpreter(final String interpreter) { expression.setInterpreter(interpreter); return this; }
/** * Sets the type of this expression. * * @param expressionType the expression type to use. * @return this ExpressionBuilder itself, for chain calls. * @see ExpressionType */ public ExpressionBuilder setExpressionType(final ExpressionType expressionType) { expression.setExpressionType(expressionType.name()); return this; }
/** @deprecated use {@link #setExpressionType(ExpressionType)} instead */ @Deprecated public ExpressionBuilder setExpressionType(final String expressionType) { expression.setExpressionType(expressionType); return this; }
public ExpressionBuilder setContent(final String content) { expression.setContent(content); return this; }