@Override public FilterExpression parseFilterString(final EdmEntityType entityType, final String expression) throws ODataMessageException { return new FilterParserImpl(entityType, strictFilter).parseFilterString(expression); }
protected CommonExpression readElement(final CommonExpression leftExpression) throws ExpressionParserException, ExpressionParserInternalError { return readElement(leftExpression, null); }
protected CommonExpression readMethod(final Token token, final InfoMethod methodOperator) throws ExpressionParserException, ExpressionParserInternalError { MethodExpressionImpl method = new MethodExpressionImpl(methodOperator); readParameters(methodOperator, method, token); validateMethodTypes(method, token); // throws ExpressionInvalidOperatorTypeException return method; }
node = readParenthesis(); return node; case CLOSEPAREN: // ')' finishes a parenthesis (it is no extra token)" + InfoUnaryOperator unaryOperator = isUnaryOperator(lookToken); if (unaryOperator != null) { return readUnaryoperator(lookToken, unaryOperator); InfoMethod methodOperator = isMethod(token, lookToken); if (methodOperator != null) { return readMethod(token, methodOperator); validateEdmProperty(leftExpression, property, token, leftOperator); return property;
BinaryExpression binaryNode; ActualBinaryOperator operator = readBinaryOperator(); ActualBinaryOperator nextOperator; rightNode = readElement(leftNode, operator); // throws FilterParserException, FilterParserInternalError if (rightNode == null) { + operator.getToken().getUriLiteral().length(), curExpression); nextOperator = readBinaryOperator(); rightNode = readElements(rightNode, nextOperator.getOP().getPriority()); nextOperator = readBinaryOperator(); validateBinaryOperatorTypes(binaryNode); } catch (ExpressionParserException expressionException) { operator = readBinaryOperator();
/** * Reads the content between parenthesis. Its is expected that the current token is of kind * {@link TokenKind#OPENPAREN} because it MUST be check in the calling method ( when read the method name and the '(' * is read). * @return An expression which reflects the content within the parenthesis * @throws ExpressionParserException * While reading the elements in the parenthesis an error occurred * @throws TokenizerMessage * The next token did not match the expected token */ protected CommonExpression readParenthesis() throws ExpressionParserException, ExpressionParserInternalError { // The existing of a '(' is verified BEFORE this method is called --> so it's a internal error Token openParenthesis = tokenList.expectToken(TokenKind.OPENPAREN, true); CommonExpression firstExpression = readElement(null); CommonExpression parenthesisExpression = readElements(firstExpression, 0); // check for ')' try { tokenList.expectToken(TokenKind.CLOSEPAREN); // TokenizerMessage } catch (TokenizerExpectError e) { // Internal parsing error, even if there are no more token (then there should be a different exception). // Tested with TestParserExceptions.TestPMreadParenthesis throw FilterParserExceptionImpl.createMISSING_CLOSING_PHARENTHESIS(openParenthesis.getPosition(), curExpression, e); } return parenthesisExpression; }
protected CommonExpression readUnaryoperator(final Token lookToken, final InfoUnaryOperator unaryOperator) throws ExpressionParserException, ExpressionParserInternalError { tokenList.expectToken(lookToken.getUriLiteral(), true); CommonExpression operand = readElement(null); UnaryExpression unaryExpression = new UnaryExpressionImpl(unaryOperator, operand); validateUnaryOperatorTypes(unaryExpression); // throws ExpressionInvalidOperatorTypeException return unaryExpression; }
/** * Creates OData parser. * * @param tclass - class of T used to create condition objects in built syntax tree. Class T must have * accessible no-arg constructor and complementary setters to these used in * OData $filter expressions. * @param contextProperties */ public ODataParser(Class<T> tclass, Map<String, String> contextProperties, Map<String, String> beanProperties) { super(tclass, contextProperties, beanProperties); this.parser = new FilterParserImpl(null); }
@Override public FilterExpression parseFilterString(final String filterExpression) throws ExpressionParserException, ExpressionParserInternalError { return parseFilterString(filterExpression, false); }
node = readParenthesis(); return node; case CLOSEPAREN: // ')' finishes a parenthesis (it is no extra token)" + InfoUnaryOperator unaryOperator = isUnaryOperator(lookToken); if (unaryOperator != null) { return readUnaryoperator(lookToken, unaryOperator); InfoMethod methodOperator = isMethod(token, lookToken); if (methodOperator != null) { return readMethod(token, methodOperator); validateEdmProperty(leftExpression, property, token, leftOperator); return property;
BinaryExpression binaryNode; ActualBinaryOperator operator = readBinaryOperator(); ActualBinaryOperator nextOperator; rightNode = readElement(leftNode, operator); // throws FilterParserException, FilterParserInternalError if (rightNode == null) { + operator.getToken().getUriLiteral().length(), curExpression); nextOperator = readBinaryOperator(); rightNode = readElements(rightNode, nextOperator.getOP().getPriority()); nextOperator = readBinaryOperator(); validateBinaryOperatorTypes(binaryNode); } catch (ExpressionParserException expressionException) { operator = readBinaryOperator();
/** * Reads the content between parenthesis. Its is expected that the current token is of kind * {@link TokenKind#OPENPAREN} because it MUST be check in the calling method ( when read the method name and the '(' * is read). * @return An expression which reflects the content within the parenthesis * @throws ExpressionParserException * While reading the elements in the parenthesis an error occurred * @throws TokenizerMessage * The next token did not match the expected token */ protected CommonExpression readParenthesis() throws ExpressionParserException, ExpressionParserInternalError { // The existing of a '(' is verified BEFORE this method is called --> so it's a internal error Token openParenthesis = tokenList.expectToken(TokenKind.OPENPAREN, true); CommonExpression firstExpression = readElement(null); CommonExpression parenthesisExpression = readElements(firstExpression, 0); // check for ')' try { tokenList.expectToken(TokenKind.CLOSEPAREN); // TokenizerMessage } catch (TokenizerExpectError e) { // Internal parsing error, even if there are no more token (then there should be a different exception). // Tested with TestParserExceptions.TestPMreadParenthesis throw FilterParserExceptionImpl.createMISSING_CLOSING_PARENTHESIS(openParenthesis.getPosition(), curExpression, e); } return parenthesisExpression; }
protected CommonExpression readUnaryoperator(final Token lookToken, final InfoUnaryOperator unaryOperator) throws ExpressionParserException, ExpressionParserInternalError { tokenList.expectToken(lookToken.getUriLiteral(), true); CommonExpression operand = readElement(null); UnaryExpression unaryExpression = new UnaryExpressionImpl(unaryOperator, operand); validateUnaryOperatorTypes(unaryExpression); // throws ExpressionInvalidOperatorTypeException return unaryExpression; }
/** * Creates OData parser. * * @param tclass - class of T used to create condition objects in built syntax tree. Class T must have * accessible no-arg constructor and complementary setters to these used in * OData $filter expressions. * @param contextProperties */ public ODataParser(Class<T> tclass, Map<String, String> contextProperties, Map<String, String> beanProperties) { super(tclass, contextProperties, beanProperties); this.parser = new FilterParserImpl(null); }
@Override public FilterExpression parseFilterString(final String filterExpression) throws ExpressionParserException, ExpressionParserInternalError { return parseFilterString(filterExpression, false); }
node = readParenthesis(); return node; case CLOSEPAREN: // ')' finishes a parenthesis (it is no extra token)" + InfoUnaryOperator unaryOperator = isUnaryOperator(lookToken); if (unaryOperator != null) { return readUnaryoperator(lookToken, unaryOperator); InfoMethod methodOperator = isMethod(token, lookToken); if (methodOperator != null) { return readMethod(token, methodOperator); validateEdmProperty(leftExpression, property, token, leftOperator); return property;
BinaryExpression binaryNode; ActualBinaryOperator operator = readBinaryOperator(); ActualBinaryOperator nextOperator; rightNode = readElement(leftNode, operator); // throws FilterParserException, FilterParserInternalError if (rightNode == null) { + operator.getToken().getUriLiteral().length(), curExpression); nextOperator = readBinaryOperator(); rightNode = readElements(rightNode, nextOperator.getOP().getPriority()); nextOperator = readBinaryOperator(); validateBinaryOperatorTypes(binaryNode); } catch (ExpressionParserException expressionException) { operator = readBinaryOperator();
/** * Reads the content between parenthesis. Its is expected that the current token is of kind * {@link TokenKind#OPENPAREN} because it MUST be check in the calling method ( when read the method name and the '(' * is read). * @return An expression which reflects the content within the parenthesis * @throws ExpressionParserException * While reading the elements in the parenthesis an error occurred * @throws TokenizerMessage * The next token did not match the expected token */ protected CommonExpression readParenthesis() throws ExpressionParserException, ExpressionParserInternalError { // The existing of a '(' is verified BEFORE this method is called --> so it's a internal error Token openParenthesis = tokenList.expectToken(TokenKind.OPENPAREN, true); CommonExpression firstExpression = readElement(null); CommonExpression parenthesisExpression = readElements(firstExpression, 0); // check for ')' try { tokenList.expectToken(TokenKind.CLOSEPAREN); // TokenizerMessage } catch (TokenizerExpectError e) { // Internal parsing error, even if there are no more token (then there should be a different exception). // Tested with TestParserExceptions.TestPMreadParenthesis throw FilterParserExceptionImpl.createMISSING_CLOSING_PARENTHESIS(openParenthesis.getPosition(), curExpression, e); } return parenthesisExpression; }
@Override public FilterExpression parseFilterString(final EdmEntityType entityType, final String expression) throws ODataMessageException { return new FilterParserImpl(entityType).parseFilterString(expression); }
protected CommonExpression readUnaryoperator(final Token lookToken, final InfoUnaryOperator unaryOperator) throws ExpressionParserException, ExpressionParserInternalError { tokenList.expectToken(lookToken.getUriLiteral(), true); CommonExpression operand = readElement(null); UnaryExpression unaryExpression = new UnaryExpressionImpl(unaryOperator, operand); validateUnaryOperatorTypes(unaryExpression); // throws ExpressionInvalidOperatorTypeException return unaryExpression; }