Пример #1
0
  /**
   * 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;
  }
Пример #2
0
 /**
  * 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;
 }
Пример #3
0
 public ExpressionBuilder setName(final String name) {
   expression.setName(name);
   return this;
 }
Пример #4
0
 public ExpressionBuilder setDependencies(final List<Expression> dependencies) {
   expression.setDependencies(dependencies);
   return this;
 }
Пример #5
0
 public ExpressionBuilder setInterpreter(final String interpreter) {
   expression.setInterpreter(interpreter);
   return this;
 }
Пример #6
0
 /**
  * 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;
 }
Пример #7
0
 /** @deprecated use {@link #setExpressionType(ExpressionType)} instead */
 @Deprecated
 public ExpressionBuilder setExpressionType(final String expressionType) {
   expression.setExpressionType(expressionType);
   return this;
 }
Пример #8
0
 public ExpressionBuilder setContent(final String content) {
   expression.setContent(content);
   return this;
 }