use of org.eclipse.persistence.jpa.jpql.parser.CastExpression in project eclipselink by eclipse-ee4j.
the class EclipseLinkContentAssistVisitor method visit.
@Override
public void visit(CastExpression expression) {
super.visit(expression);
int position = queryPosition.getPosition(expression) - corrections.peek();
String identifier = expression.getIdentifier();
// Within CAST
if (isPositionWithin(position, identifier)) {
addIdentifier(identifier);
addIdentificationVariables();
addFunctionIdentifiers(expression.getParent().findQueryBNF(expression));
} else // After "CAST("
if (expression.hasLeftParenthesis()) {
int length = identifier.length() + 1;
// Right after "CAST("
if (position == length) {
addIdentificationVariables();
addFunctionIdentifiers(expression.getEncapsulatedExpressionQueryBNFId());
} else if (expression.hasExpression()) {
Expression scalarExpression = expression.getExpression();
if (isComplete(scalarExpression)) {
length += scalarExpression.getLength();
if (expression.hasSpaceAfterExpression()) {
length++;
// Right before "AS" or database type
if (position == length) {
addAggregateIdentifiers(expression.getEncapsulatedExpressionQueryBNFId());
proposals.addIdentifier(AS);
} else // Within "AS"
if (isPositionWithin(position, length, AS)) {
proposals.addIdentifier(AS);
}
}
}
}
}
}
use of org.eclipse.persistence.jpa.jpql.parser.CastExpression in project eclipselink by eclipse-ee4j.
the class ReportItemBuilder method visit.
@Override
public void visit(CastExpression expression) {
Expression queryExpression = queryContext.buildExpression(expression, type);
addAttribute(ExpressionTools.EMPTY_STRING, queryExpression, type[0]);
}
Aggregations