Class FilterParserImpl
java.lang.Object
org.apache.olingo.odata2.core.uri.expression.FilterParserImpl
- All Implemented Interfaces:
FilterParser
- Direct Known Subclasses:
OrderByParserImpl
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionFilterParserImpl(EdmEntityType resourceEntityType) Creates a new FilterParser implementation -
Method Summary
Modifier and TypeMethodDescriptionprotected org.apache.olingo.odata2.core.uri.expression.InfoMethodprotected org.apache.olingo.odata2.core.uri.expression.InfoUnaryOperatorisUnaryOperator(Token token) Check if a token is a UnaryOperator ( e.g.parseFilterString(String filterExpression) Parses a $filter expression string and creates an $orderby expression tree.parseFilterString(String filterExpression, boolean allowOnlyBinary) protected ActualBinaryOperatorprotected CommonExpressionreadElement(CommonExpression leftExpression) protected CommonExpressionreadElement(CommonExpression leftExpression, ActualBinaryOperator leftOperator) Reads: Unary operators, Methods, Properties, ...but not binary operators which are handelt inreadElements(CommonExpression, int)protected CommonExpressionreadElements(CommonExpression leftExpression, int priority) protected CommonExpressionreadMethod(Token token, org.apache.olingo.odata2.core.uri.expression.InfoMethod methodOperator) protected MethodExpressionreadParameters(org.apache.olingo.odata2.core.uri.expression.InfoMethod methodInfo, MethodExpressionImpl methodExpression, Token methodToken) Read the parameters of a method expressionprotected CommonExpressionReads the content between parenthesis.protected CommonExpressionreadUnaryoperator(Token lookToken, org.apache.olingo.odata2.core.uri.expression.InfoUnaryOperator unaryOperator) protected voidvalidateBinaryOperatorTypes(BinaryExpression binaryExpression) protected voidvalidateEdmProperty(CommonExpression leftExpression, PropertyExpressionImpl property, Token propertyToken, ActualBinaryOperator actBinOp) protected voidvalidateEdmPropertyOfStructuredType(EdmStructuralType parentType, PropertyExpressionImpl property, Token propertyToken) protected voidvalidateMethodTypes(MethodExpression methodExpression, Token methodToken) protected voidvalidateUnaryOperatorTypes(UnaryExpression unaryExpression)
-
Field Details
-
availableBinaryOperators
-
availableMethods
-
availableUnaryOperators
-
resourceEntityType
-
tokenList
-
curExpression
-
-
Constructor Details
-
FilterParserImpl
Creates a new FilterParser implementation- Parameters:
resourceEntityType- EntityType of the resource on which the filter is applied
-
-
Method Details
-
parseFilterString
public FilterExpression parseFilterString(String filterExpression) throws ExpressionParserException, ExpressionParserInternalError Description copied from interface:FilterParserParses a $filter expression string and creates an $orderby expression tree.- Specified by:
parseFilterStringin interfaceFilterParser- Parameters:
filterExpression- The $filter expression string ( for example "city eq 'Sydney'" ) to be parsed- Returns:
- Expression tree which can be traversed with help of the interfaces
ExpressionVisitorandVisitable - Throws:
ExpressionParserException- Exception thrown due to errors while parsing the $filter expression stringExpressionParserInternalError
-
parseFilterString
public FilterExpression parseFilterString(String filterExpression, boolean allowOnlyBinary) throws ExpressionParserException, ExpressionParserInternalError -
readElements
protected CommonExpression readElements(CommonExpression leftExpression, int priority) throws ExpressionParserException, ExpressionParserInternalError -
readParenthesis
protected CommonExpression readParenthesis() throws ExpressionParserException, ExpressionParserInternalErrorReads the content between parenthesis. Its is expected that the current token is of kindTokenKind.OPENPARENbecause it MUST be check in the calling method ( when read the method name and the '(' is read).- Returns:
- An expression which reflects the content within the parenthesis
- Throws:
ExpressionParserException- While reading the elements in the parenthesis an error occurredExpressionParserInternalError- The next token did not match the expected token
-
readParameters
protected MethodExpression readParameters(org.apache.olingo.odata2.core.uri.expression.InfoMethod methodInfo, MethodExpressionImpl methodExpression, Token methodToken) throws ExpressionParserException, ExpressionParserInternalError Read the parameters of a method expression- Parameters:
methodInfo- Signature information about the method whose parameters should be readmethodExpression- Method expression to which the read parameters are addedmethodToken- Metodo- Returns:
- The method expression input parameter
- Throws:
ExpressionParserException- The next token did not match the expected tokenExpressionParserInternalError- The next token did not match the expected token
-
readElement
protected CommonExpression readElement(CommonExpression leftExpression) throws ExpressionParserException, ExpressionParserInternalError -
readElement
protected CommonExpression readElement(CommonExpression leftExpression, ActualBinaryOperator leftOperator) throws ExpressionParserException, ExpressionParserInternalError Reads: Unary operators, Methods, Properties, ...but not binary operators which are handelt inreadElements(CommonExpression, int)- Parameters:
leftExpression- Used while parsing properties. In this case ( e.g. parsing "a/b") the property "a" ( as leftExpression of "/") is relevant to verify whether the property "b" exists inside the edmleftOperator- Operator- Returns:
- a CommonExpression
- Throws:
ExpressionParserException- Caso ocorra uma exceçãoExpressionParserInternalError- Caso ocorra uma exceção
-
readUnaryoperator
protected CommonExpression readUnaryoperator(Token lookToken, org.apache.olingo.odata2.core.uri.expression.InfoUnaryOperator unaryOperator) throws ExpressionParserException, ExpressionParserInternalError -
readMethod
protected CommonExpression readMethod(Token token, org.apache.olingo.odata2.core.uri.expression.InfoMethod methodOperator) throws ExpressionParserException, ExpressionParserInternalError -
readBinaryOperator
-
isUnaryOperator
protected org.apache.olingo.odata2.core.uri.expression.InfoUnaryOperator isUnaryOperator(Token token) Check if a token is a UnaryOperator ( e.g. "not" or "-" )- Parameters:
token- Token to be checked- Returns:
- An instance of
InfoUnaryOperatorcontaining information about the specific unary operator nullif the token is not an unary operator
- An instance of
-
isMethod
-
validateEdmProperty
protected void validateEdmProperty(CommonExpression leftExpression, PropertyExpressionImpl property, Token propertyToken, ActualBinaryOperator actBinOp) throws ExpressionParserException, ExpressionParserInternalError -
validateEdmPropertyOfStructuredType
protected void validateEdmPropertyOfStructuredType(EdmStructuralType parentType, PropertyExpressionImpl property, Token propertyToken) throws ExpressionParserException, ExpressionParserInternalError -
validateUnaryOperatorTypes
protected void validateUnaryOperatorTypes(UnaryExpression unaryExpression) throws ExpressionParserInternalError - Throws:
ExpressionParserInternalError
-
validateBinaryOperatorTypes
protected void validateBinaryOperatorTypes(BinaryExpression binaryExpression) throws ExpressionParserException, ExpressionParserInternalError -
validateMethodTypes
protected void validateMethodTypes(MethodExpression methodExpression, Token methodToken) throws ExpressionParserException, ExpressionParserInternalError
-