use of org.eclipse.persistence.jpa.jpql.parser.DateTime in project eclipselink by eclipse-ee4j.
the class ExpressionBuilderVisitor method visit.
@Override
public void visit(DateTime expression) {
if (expression.isJDBCDate()) {
queryExpression = queryContext.getBaseExpression();
queryExpression = new DateConstantExpression(expression.getText(), queryExpression);
String text = expression.getText();
if (text.startsWith("{d")) {
type[0] = Date.class;
} else if (text.startsWith("{ts")) {
type[0] = Timestamp.class;
} else if (text.startsWith("{t")) {
type[0] = Time.class;
} else {
type[0] = Object.class;
}
} else {
queryExpression = queryContext.getBaseExpression();
if (expression.isCurrentDate()) {
queryExpression = queryExpression.currentDateDate();
type[0] = Date.class;
} else if (expression.isCurrentTime()) {
queryExpression = queryExpression.currentTime();
type[0] = Time.class;
} else if (expression.isCurrentTimestamp()) {
queryExpression = queryExpression.currentTimeStamp();
type[0] = Timestamp.class;
} else {
throw new IllegalArgumentException("The DateTime is unknown: " + expression);
}
}
}
use of org.eclipse.persistence.jpa.jpql.parser.DateTime in project eclipselink by eclipse-ee4j.
the class AbstractActualJPQLQueryFormatter method visit.
@Override
public void visit(DateTimeStateObject stateObject) {
if (stateObject.isDecorated()) {
toText(stateObject);
} else {
DateTime expression = stateObject.getExpression();
appendIdentifier((expression != null) ? expression.getActualIdentifier() : stateObject.getText(), stateObject.getText());
}
}
Aggregations