protected <T> SimpleCaseImpl (Metamodel metamodel, Class<R> resultClass, FunctionExpression expressionNode, List<Expression<?>> compoundExpressions, String operator, Expression<C> expression){ super(metamodel, resultClass, expressionNode, compoundExpressions, operator); this.expression = expression; expressionNode.addChild(((InternalSelection)expression).getCurrentNode()); }
protected <T> SimpleCaseImpl (Metamodel metamodel, Class<R> resultClass, FunctionExpression expressionNode, List<Expression<?>> compoundExpressions, Expression<C> expression){ super(metamodel, resultClass, expressionNode, compoundExpressions); this.expression = expression; expressionNode.addChild(((InternalSelection)expression).getCurrentNode()); }
/** * INTERNAL: */ public Expression create(Expression base, Vector arguments, ExpressionOperator operator) { baseExpression = base; addChild(base); for (Enumeration e = arguments.elements(); e.hasMoreElements();) { Expression arg = Expression.from(e.nextElement(), base); addChild(arg); } setOperator(operator); return this; }
/** * INTERNAL: * added for Trim support. TRIM([trim_character FROM] string_primary) */ public Expression createWithBaseLast(Expression base, Object singleArgument, ExpressionOperator anOperator) { baseExpression = base; Expression arg = Expression.from(singleArgument, base); addChild(arg); addChild(base); setOperator(anOperator); return this; }
/** * Add an argument to the coalesce expression. * @param value expression * @return coalesce expression */ public Coalesce<X> value(Expression<? extends X> value){ org.eclipse.persistence.expressions.Expression exp = ((InternalSelection)value).getCurrentNode(); exp = org.eclipse.persistence.expressions.Expression.from(exp, currentNode); ((FunctionExpression)currentNode).addChild(exp); return this; } }
/** * INTERNAL: * Used for cloning. */ protected void postCopyIn(Map alreadyDone) { super.postCopyIn(alreadyDone); Vector oldChildren = children; children = org.eclipse.persistence.internal.helper.NonSynchronizedVector.newInstance(); for (int i = 0; i < oldChildren.size(); i++) { addChild((((Expression)oldChildren.elementAt(i)).copiedVersionFrom(alreadyDone))); } }
/** * INTERNAL: * Add a child and ensure it is the rightmost in the tree as long as it * is in the tree * If there is already a node that is set as therightmost node, replace it * @param argument */ public synchronized void addRightMostChild(Expression argument){ if (hasLastChild != null && hasLastChild.booleanValue()){ getChildren().remove(super.getChildren().size() - 1); super.addChild(argument); } else { this.addChild(argument); } this.hasLastChild = Boolean.valueOf(true); }
/** * INTERNAL: * Used for cloning. */ @Override protected void postCopyIn(Map alreadyDone) { super.postCopyIn(alreadyDone); Vector<Expression> oldChildren = this.children; this.children = org.eclipse.persistence.internal.helper.NonSynchronizedVector.newInstance(); for (int i = 0; i < oldChildren.size(); i++) { addChild((oldChildren.elementAt(i).copiedVersionFrom(alreadyDone))); } }
/** * Add a when/then clause to the case expression. * @param condition "when" condition * @param result "then" result expression * @return general case expression */ public Case<R> when(Expression<Boolean> condition, Expression<? extends R> result){ org.eclipse.persistence.expressions.Expression conditionExp = ((InternalSelection)condition).getCurrentNode(); conditionExp = org.eclipse.persistence.expressions.Expression.from(conditionExp, currentNode); ((FunctionExpression)currentNode).addChild(conditionExp); org.eclipse.persistence.expressions.Expression resultExp = ((InternalSelection)result).getCurrentNode(); resultExp = org.eclipse.persistence.expressions.Expression.from(resultExp, currentNode); ((FunctionExpression)currentNode).addChild(resultExp); return this; }
/** * Add an argument to the coalesce expression. * @param value value * @return coalesce expression */ public Coalesce<X> value(X value){ org.eclipse.persistence.expressions.Expression exp = org.eclipse.persistence.expressions.Expression.from(value, new ExpressionBuilder()); ((FunctionExpression)currentNode).addChild(exp); return this; }
/** * INTERNAL: * Used for cloning. */ protected void postCopyIn(Map alreadyDone) { super.postCopyIn(alreadyDone); Vector oldChildren = children; children = org.eclipse.persistence.internal.helper.NonSynchronizedVector.newInstance(); for (int i = 0; i < oldChildren.size(); i++) { addChild((((Expression)oldChildren.elementAt(i)).copiedVersionFrom(alreadyDone))); } }
/** * INTERNAL: * Add a child and ensure it is the rightmost in the tree as long as it * is in the tree * If there is already a node that is set as therightmost node, replace it * @param argument */ public synchronized void addRightMostChild(Expression argument){ if (hasLastChild != null && hasLastChild.booleanValue()){ getChildren().remove(super.getChildren().size() - 1); super.addChild(argument); } else { this.addChild(argument); } this.hasLastChild = Boolean.TRUE; }
/** * Add a when/then clause to the case expression. * @param condition "when" condition * @param result "then" result value * @return general case expression */ public Case<R> when(Expression<Boolean> condition, R result){ org.eclipse.persistence.expressions.Expression conditionExp = ((InternalSelection)condition).getCurrentNode(); conditionExp = org.eclipse.persistence.expressions.Expression.from(conditionExp, currentNode); ((FunctionExpression)currentNode).addChild(conditionExp); org.eclipse.persistence.expressions.Expression resultExp = org.eclipse.persistence.expressions.Expression.from(result, new ExpressionBuilder()); ((FunctionExpression)currentNode).addChild(resultExp); return this; }
/** * Add a when/then clause to the case expression. * @param condition "when" condition * @param result "then" result value * @return simple case expression */ public SimpleCase<C, R> when(C condition, R result){ org.eclipse.persistence.expressions.Expression conditionExp = org.eclipse.persistence.expressions.Expression.from(condition, new ExpressionBuilder()); ((FunctionExpression)currentNode).addChild(conditionExp); org.eclipse.persistence.expressions.Expression resultExp = org.eclipse.persistence.expressions.Expression.from(result, new ExpressionBuilder()); ((FunctionExpression)currentNode).addChild(resultExp); return this; }
/** * INTERNAL: * Add a child and ensure it is the rightmost in the tree as long as it * is in the tree * If there is already a node that is set as therightmost node, replace it * @param argument */ public synchronized void addRightMostChild(Expression argument){ if (hasLastChild != null && hasLastChild.booleanValue()){ getChildren().remove(super.getChildren().size() - 1); super.addChild(argument); } else { this.addChild(argument); } this.hasLastChild = Boolean.TRUE; }
/** * Add a when/then clause to the case expression. * @param condition "when" condition * @param result "then" result expression * @return simple case expression */ public SimpleCase<C, R> when(C condition, Expression<? extends R> result){ org.eclipse.persistence.expressions.Expression conditionExp = org.eclipse.persistence.expressions.Expression.from(condition, new ExpressionBuilder()); ((FunctionExpression)currentNode).addChild(conditionExp); org.eclipse.persistence.expressions.Expression resultExp = ((InternalSelection)result).getCurrentNode(); resultExp = org.eclipse.persistence.expressions.Expression.from(resultExp, currentNode); ((FunctionExpression)currentNode).addChild(resultExp); return this; }
/** * INTERNAL: * Add a new Expression to the list of arguments. * This method will update the list of arguments and any constant strings that are required * to be printed with the arguments * @param argument */ @Override public synchronized void addChild(Expression argument){ if (hasLastChild != null && hasLastChild.booleanValue()){ getChildren().add(getChildren().size() - 1, argument); } else { super.addChild(argument); } setBaseExpression(getChildren().firstElement()); ((ListExpressionOperator)operator).incrementNumberOfItems(); }
/** * INTERNAL: * Add a new Expression to the list of arguments. * This method will update the list of arguments and any constant strings that are required * to be printed with the arguments * @param argument */ @Override public synchronized void addChild(Expression argument){ if (hasLastChild != null && hasLastChild.booleanValue()){ getChildren().add(getChildren().size() - 1, argument); } else { super.addChild(argument); } setBaseExpression((Expression)getChildren().firstElement()); ((ListExpressionOperator)operator).incrementNumberOfItems(); }
/** * INTERNAL: * Add a new Expression to the list of arguments. * This method will update the list of arguments and any constant strings that are required * to be printed with the arguments * @param argument */ @Override public synchronized void addChild(Expression argument){ if (hasLastChild != null && hasLastChild.booleanValue()){ getChildren().add(getChildren().size() - 1, argument); } else { super.addChild(argument); } setBaseExpression((Expression)getChildren().firstElement()); ((ListExpressionOperator)operator).incrementNumberOfItems(); }