Class EntityQueryParser
java.lang.Object
com.foreach.across.modules.entity.query.EntityQueryParser
Reverse parsing of a
String
into an EntityQuery
.
Uses a DefaultEntityQueryMetadataProvider
if none is set.- Since:
- 2.0.0
- Author:
- Arne Vandamme
- See Also:
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionConvert a query string into a typed and validatedEntityQuery
.static EntityQuery
parseRawQuery
(String eql) Parse an EQL statement into a rawEntityQuery
.prepare
(EntityQuery rawQuery) Convert a rawEntityQuery
instance into a validated and executable query instance that can be passed to theEntityQueryExecutor
of the corresponding entity.void
setMetadataProvider
(@NonNull EntityQueryMetadataProvider metadataProvider) Set the actualEntityQueryMetadataProvider
that should be used for validating and typing query strings.void
setQueryTranslator
(@NonNull EntityQueryTranslator queryTranslator) Set theDefaultEntityQueryTranslator
to use for translating raw queries that passed validation.void
-
Constructor Details
-
EntityQueryParser
public EntityQueryParser()
-
-
Method Details
-
setMetadataProvider
Set the actualEntityQueryMetadataProvider
that should be used for validating and typing query strings.- Parameters:
metadataProvider
- instance
-
setQueryTranslator
Set theDefaultEntityQueryTranslator
to use for translating raw queries that passed validation.- Parameters:
queryTranslator
- instance
-
validateProperties
public void validateProperties() -
parse
Convert a query string into a typed and validatedEntityQuery
. ThesetMetadataProvider(EntityQueryMetadataProvider)
value will be used for validating the query, and - when passing validation - query will be translated by theEntityQueryTranslator
.An exception will be thrown if the query cannot be converted.
- Parameters:
queryString
- string representation of the query- Returns:
- query instance
- Throws:
IllegalArgumentException
- if parsing fails
-
prepare
Convert a rawEntityQuery
instance into a validated and executable query instance that can be passed to theEntityQueryExecutor
of the corresponding entity. Query translation will be done by the configuredEntityQueryTranslator
?- Parameters:
rawQuery
- to convert- Returns:
- executable query instance
-
parseRawQuery
Parse an EQL statement into a rawEntityQuery
. Exceptions will be thrown in case parsing fails.- Parameters:
eql
- query- Returns:
- query
-