Search in sources :

Example 1 with ConditionResult

use of org.jnosql.artemis.document.query.DocumentQueryParserUtil.ConditionResult in project jnosql-artemis by eclipse.

the class DocumentQueryDeleteParser method parse.

public DocumentDeleteQuery parse(String methodName, Object[] args, ClassRepresentation representation, Converters converters) {
    String[] tokens = methodName.replace(PREFIX, DocumentQueryParserUtil.EMPTY).split(TOKENIZER);
    DocumentCondition condition = null;
    int index = 0;
    for (String token : tokens) {
        if (token.startsWith(DocumentQueryParserUtil.AND)) {
            ConditionResult result = and(args, index, token, methodName, representation, condition, converters);
            condition = result.getCondition();
            index = result.getIndex();
        } else if (token.startsWith(DocumentQueryParserUtil.OR)) {
            ConditionResult result = or(args, index, token, methodName, representation, condition, converters);
            condition = result.getCondition();
            index = result.getIndex();
        } else {
            condition = toCondition(token, index, args, methodName, representation, converters);
            index++;
        }
    }
    return new ArtemisDocumentDeleteQuery(representation.getName(), condition);
}
Also used : ConditionResult(org.jnosql.artemis.document.query.DocumentQueryParserUtil.ConditionResult) DocumentCondition(org.jnosql.diana.api.document.DocumentCondition)

Aggregations

ConditionResult (org.jnosql.artemis.document.query.DocumentQueryParserUtil.ConditionResult)1 DocumentCondition (org.jnosql.diana.api.document.DocumentCondition)1