use of org.eclipse.persistence.jpa.jpql.parser.RegexpExpression in project eclipselink by eclipse-ee4j.
the class AbstractEclipseLinkParameterTypeVisitor method visit.
@Override
public void visit(RegexpExpression expression) {
Expression patternValue = expression.getPatternValue();
Expression stringExpression = expression.getStringExpression();
if (patternValue.isAncestor(inputParameter)) {
this.expression = expression.getStringExpression();
} else if (stringExpression.isAncestor(inputParameter)) {
this.expression = expression;
}
}
use of org.eclipse.persistence.jpa.jpql.parser.RegexpExpression in project eclipselink by eclipse-ee4j.
the class ExpressionBuilderVisitor method visit.
@Override
public void visit(RegexpExpression expression) {
// Create the first expression
expression.getStringExpression().accept(this);
Expression firstExpression = queryExpression;
// Create the expression for the pattern value
expression.getPatternValue().accept(this);
Expression patternValue = queryExpression;
// Create the REGEXP expression
queryExpression = firstExpression.regexp(patternValue);
// Set the expression type
type[0] = Boolean.class;
}
use of org.eclipse.persistence.jpa.jpql.parser.RegexpExpression in project eclipselink by eclipse-ee4j.
the class EclipseLinkGrammarValidator method visit.
@Override
public void visit(RegexpExpression expression) {
// Wrong JPA version
if (!isEclipseLink()) {
addProblem(expression, RegexpExpression_InvalidJPAVersion);
} else {
// Missing string expression
if (!expression.hasStringExpression()) {
int startPosition = position(expression);
int endPosition = startPosition;
addProblem(expression, startPosition, endPosition, RegexpExpression_MissingStringExpression);
} else {
Expression stringExpression = expression.getStringExpression();
// Invalid string expression
if (!isValid(stringExpression, StringExpressionBNF.ID)) {
int startPosition = position(stringExpression);
int endPosition = startPosition + length(stringExpression);
addProblem(expression, startPosition, endPosition, RegexpExpression_InvalidStringExpression);
} else // Validate string expression
{
stringExpression.accept(this);
}
}
// Missing pattern value
if (!expression.hasPatternValue()) {
int startPosition = position(expression) + length(expression.getStringExpression()) + (expression.hasSpaceAfterStringExpression() ? 1 : 0) + 6 + /* REGEXP */
(expression.hasSpaceAfterIdentifier() ? 1 : 0);
int endPosition = startPosition;
addProblem(expression, startPosition, endPosition, RegexpExpression_MissingPatternValue);
} else {
Expression patternValue = expression.getStringExpression();
// Invalid string expression
if (!isValid(patternValue, PatternValueBNF.ID)) {
int startPosition = position(expression) + length(expression.getStringExpression()) + (expression.hasSpaceAfterStringExpression() ? 1 : 0) + 6 + /* REGEXP */
(expression.hasSpaceAfterIdentifier() ? 1 : 0);
int endPosition = startPosition + length(patternValue);
addProblem(expression, startPosition, endPosition, RegexpExpression_InvalidPatternValue);
} else // Validate pattern value
{
patternValue.accept(this);
}
}
}
}
Aggregations