Search in sources :

Example 1 with NotEvaluator

use of org.apache.synapse.commons.evaluators.NotEvaluator in project wso2-synapse by wso2.

the class NotFactory method create.

public Evaluator create(OMElement e) throws EvaluatorException {
    NotEvaluator not = new NotEvaluator();
    OMElement ce = e.getFirstElement();
    EvaluatorFactory ef = EvaluatorFactoryFinder.getInstance().findEvaluatorFactory(ce.getLocalName());
    if (ef == null) {
        handleException("Invalid configuration element: " + ce.getLocalName());
        return null;
    }
    Evaluator evaluator = ef.create(ce);
    not.setEvaluator(evaluator);
    return not;
}
Also used : NotEvaluator(org.apache.synapse.commons.evaluators.NotEvaluator) OMElement(org.apache.axiom.om.OMElement) Evaluator(org.apache.synapse.commons.evaluators.Evaluator) NotEvaluator(org.apache.synapse.commons.evaluators.NotEvaluator)

Example 2 with NotEvaluator

use of org.apache.synapse.commons.evaluators.NotEvaluator in project wso2-synapse by wso2.

the class NotSerializer method serialize.

public OMElement serialize(OMElement parent, Evaluator evaluator) throws EvaluatorException {
    if (!(evaluator instanceof NotEvaluator)) {
        throw new IllegalArgumentException("Evalutor should be a NotEvalutor");
    }
    NotEvaluator notEvaluator = (NotEvaluator) evaluator;
    OMElement notElement = fac.createOMElement(EvaluatorConstants.NOT, EvaluatorConstants.SYNAPSE_NAMESPACE, EvaluatorConstants.EMPTY_PREFIX);
    serializeChild(notElement, notEvaluator.getEvaluator());
    if (parent != null) {
        parent.addChild(notElement);
    }
    return notElement;
}
Also used : NotEvaluator(org.apache.synapse.commons.evaluators.NotEvaluator) OMElement(org.apache.axiom.om.OMElement)

Aggregations

OMElement (org.apache.axiom.om.OMElement)2 NotEvaluator (org.apache.synapse.commons.evaluators.NotEvaluator)2 Evaluator (org.apache.synapse.commons.evaluators.Evaluator)1