Elastic Path Commerce Development

Evaluating conditional expressions

Evaluating conditional expressions

The ConditionEvaluatorService is used to evaluate a tag set against Creating conditional expressions. The evaluateConditionOnTags method of the ConditionEvaluatorService takes a tag set and a conditional expression as arguments and returns true if all the values in the tag set meet the criteria of the conditional statement.

import com.elasticpath.tags.service.ConditionEvaluatorService;
...
ConditionEvaluatorService evaluatorService =
        (ConditionEvaluatorService) getBeanByName(ContextIdNames.TAG_CONDITION_EVALUATOR_SERVICE);
boolean result = evaluatorService.evaluateConditionOnTags(tagSet, condExpr);