/** * INTERNAL: * Set the operator for this expression. The operator must be a ListExpressionOperator * This method asserts that the passed argument is a ListExpressionOperator rather than * throwing an exception since this method is entirely internal and the user should never get * this behavior */ @Override public void setOperator(ExpressionOperator theOperator) { assert(theOperator instanceof ListExpressionOperator); super.setOperator(theOperator); }
/** * INTERNAL: * Set the operator for this expression. The operator must be a ListExpressionOperator * This method asserts that the passed argument is a ListExpressionOperator rather than * throwing an exception since this method is entirely internal and the user should never get * this behavior */ @Override public void setOperator(ExpressionOperator theOperator) { assert(theOperator instanceof ListExpressionOperator); super.setOperator(theOperator); ((ListExpressionOperator)theOperator).setNumberOfItems(0); }
/** * INTERNAL: * Set the operator for this expression. The operator must be a ListExpressionOperator * This method asserts that the passed argument is a ListExpressionOperator rather than * throwing an exception since this method is entirely internal and the user should never get * this behavior */ @Override public void setOperator(ExpressionOperator theOperator) { assert(theOperator instanceof ListExpressionOperator); super.setOperator(theOperator); ((ListExpressionOperator)theOperator).setNumberOfItems(0); }
/** * 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: */ public Expression create(Expression base, Object singleArgument, ExpressionOperator operator) { baseExpression = base; addChild(base); Expression arg = Expression.from(singleArgument, 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; }
/** * INTERNAL: * added for Trim support. TRIM([trim_character FROM] string_primary) */ public Expression createWithBaseLast(Expression base, Object singleArgument, ExpressionOperator anOperator) { baseExpression = base; Expression localBase = base; if(anOperator.isFunctionOperator()) { ExpressionBuilder builder = getBuilder(); if(builder != null) { localBase = builder; } } Expression arg = Expression.from(singleArgument, localBase); addChild(arg); addChild(base); setOperator(anOperator); return this; }
/** * INTERNAL: */ public Expression create(Expression base, Object singleArgument, ExpressionOperator anOperator) { baseExpression = base; addChild(base); Expression localBase = base; if(anOperator.isFunctionOperator()) { ExpressionBuilder builder = getBuilder(); if(builder != null) { localBase = builder; } } Expression arg = Expression.from(singleArgument, localBase); addChild(arg); setOperator(anOperator); return this; }
/** * INTERNAL: * added for Trim support. TRIM([trim_character FROM] string_primary) */ @Override public Expression createWithBaseLast(Expression base, Object singleArgument, ExpressionOperator anOperator) { baseExpression = base; Expression localBase = base; if(anOperator.isFunctionOperator()) { ExpressionBuilder builder = getBuilder(); if(builder != null) { localBase = builder; } } Expression arg = Expression.from(singleArgument, localBase); addChild(arg); addChild(base); setOperator(anOperator); return this; }
/** * INTERNAL: */ @Override public Expression create(Expression base, List arguments, ExpressionOperator anOperator) { this.baseExpression = base; setOperator(anOperator); addChild(base); Expression localBase = base; if (anOperator.isFunctionOperator()) { ExpressionBuilder builder = getBuilder(); if (builder != null) { localBase = builder; } } for (Object argument : arguments) { Expression arg = Expression.from(argument, localBase); addChild(arg); } return this; }
/** * INTERNAL: */ @Override public Expression create(Expression base, Object singleArgument, ExpressionOperator anOperator) { baseExpression = base; addChild(base); Expression localBase = base; if(anOperator.isFunctionOperator()) { ExpressionBuilder builder = getBuilder(); if(builder != null) { localBase = builder; } } Expression arg = Expression.from(singleArgument, localBase); addChild(arg); setOperator(anOperator); return this; }
/** * PUBLIC: * Function return an integer which represents the requested * part of the date. Equivalent of the Sybase function DATEPART * <p>Example: * <blockquote><pre> * EclipseLink: employee.get("date").datePart("year") * Java: date.getYear() * SQL: DATEPART(date, year) * </pre></blockquote> */ public Expression datePart(String datePart) { ExpressionOperator anOperator = getOperator(ExpressionOperator.DatePart); FunctionExpression expression = new FunctionExpression(); expression.setBaseExpression(this); expression.addChild(Expression.fromLiteral(datePart, this)); expression.addChild(this); expression.setOperator(anOperator); return expression; }
/** * PUBLIC: * return a string that represents the given part of a date. The equivalent * of the Sybase DATENAME function * <p>Example: * <blockquote><pre> * EclipseLink: employee.get("date").dateName("year") * Java: new String(date.getYear()) * SQL: DATENAME(date, year) * </pre></blockquote> */ public Expression dateName(String datePart) { ExpressionOperator anOperator = getOperator(ExpressionOperator.DateName); FunctionExpression expression = new FunctionExpression(); expression.setBaseExpression(this); expression.addChild(Expression.fromLiteral(datePart, this)); expression.addChild(this); expression.setOperator(anOperator); return expression; }
/** * PUBLIC: * return a string that represents the given part of a date. The equivalent * of the Sybase DATENAME function * <p>Example: * <blockquote><pre> * EclipseLink: employee.get("date").dateName("year") * Java: new String(date.getYear()) * SQL: DATENAME(date, year) * </pre></blockquote> */ public Expression dateName(String datePart) { ExpressionOperator anOperator = getOperator(ExpressionOperator.DateName); FunctionExpression expression = new FunctionExpression(); expression.setBaseExpression(this); expression.addChild(Expression.fromLiteral(datePart, this)); expression.addChild(this); expression.setOperator(anOperator); return expression; }
/** * PUBLIC: * Function return an integer which represents the requested * part of the date. Equivalent of the Sybase function DATEPART * <p>Example: * <blockquote><pre> * EclipseLink: employee.get("date").datePart("year") * Java: date.getYear() * SQL: DATEPART(date, year) * </pre></blockquote> */ public Expression datePart(String datePart) { ExpressionOperator anOperator = getOperator(ExpressionOperator.DatePart); FunctionExpression expression = new FunctionExpression(); expression.setBaseExpression(this); expression.addChild(Expression.fromLiteral(datePart, this)); expression.addChild(this); expression.setOperator(anOperator); return expression; }
/** * PUBLIC: * return a string that represents the given part of a date. The equivalent * of the Sybase DATENAME function * <p>Example: * <blockquote><pre> * TopLink: employee.get("date").dateName("year") * Java: new String(date.getYear()) * SQL: DATENAME(date, year) * </blockquote></pre> * */ public Expression dateName(String datePart) { ExpressionOperator anOperator = getOperator(ExpressionOperator.DateName); FunctionExpression expression = new FunctionExpression(); expression.setBaseExpression(this); expression.addChild(Expression.fromLiteral(datePart, this)); expression.addChild(this); expression.setOperator(anOperator); return expression; }
/** * PUBLIC: * Function, Return the difference between the queried part of a date(i.e. years, days etc.) * and same part of the given date. The equivalent of the Sybase function DateDiff * <p>Example: * <blockquote><pre> * EclipseLink: employee.get("date").dateDifference("year", new Date(System.currentTimeMillis())) * Java: NA * SQL: DATEADD(date, 2, GETDATE) * </pre></blockquote> */ public Expression dateDifference(String datePart, Expression comparisonExpression) { ExpressionOperator anOperator = getOperator(ExpressionOperator.DateDifference); FunctionExpression expression = new FunctionExpression(); expression.setBaseExpression(this); expression.addChild(Expression.fromLiteral(datePart, this)); expression.addChild(comparisonExpression); expression.addChild(this); expression.setOperator(anOperator); return expression; }
/** * PUBLIC: * Function, Return the difference between the queried part of a date(i.e. years, days etc.) * and same part of the given date. The equivalent of the Sybase function DateDiff * <p>Example: * <blockquote><pre> * EclipseLink: employee.get("date").dateDifference("year", new Date(System.currentTimeMillis())) * Java: NA * SQL: DATEADD(date, 2, GETDATE) * </pre></blockquote> */ public Expression dateDifference(String datePart, Expression comparisonExpression) { ExpressionOperator anOperator = getOperator(ExpressionOperator.DateDifference); FunctionExpression expression = new FunctionExpression(); expression.setBaseExpression(this); expression.addChild(Expression.fromLiteral(datePart, this)); expression.addChild(comparisonExpression); expression.addChild(this); expression.setOperator(anOperator); return expression; }
/** * PUBLIC: * Function, Return the difference between the queried part of a date(i.e. years, days etc.) * and same part of the given date. The equivalent of the Sybase function DateDiff * <p>Example: * <blockquote><pre> * EclipseLink: employee.get("date").dateDifference("year", new Date(System.currentTimeMillis())) * Java: NA * SQL: DATEADD(date, 2, GETDATE) * </pre></blockquote> */ public Expression dateDifference(String datePart, java.util.Date date) { ExpressionOperator anOperator = getOperator(ExpressionOperator.DateDifference); FunctionExpression expression = new FunctionExpression(); expression.setBaseExpression(this); expression.addChild(Expression.fromLiteral(datePart, this)); expression.addChild(Expression.from(date, this)); expression.addChild(this); expression.setOperator(anOperator); return expression; }
/** * PUBLIC: * Function, Return the difference between the queried part of a date(i.e. years, days etc.) * and same part of the given date. The equivalent of the Sybase function DateDiff * <p>Example: * <blockquote><pre> * TopLink: employee.get("date").dateDifference("year", new Date(System.currentTimeMillis())) * Java: NA * SQL: DATEADD(date, 2, GETDATE) * </blockquote></pre> * */ public Expression dateDifference(String datePart, java.util.Date date) { ExpressionOperator anOperator = getOperator(ExpressionOperator.DateDifference); FunctionExpression expression = new FunctionExpression(); expression.setBaseExpression(this); expression.addChild(Expression.fromLiteral(datePart, this)); expression.addChild(Expression.from(date, this)); expression.addChild(this); expression.setOperator(anOperator); return expression; }