    001package com.hammurapi.common;
    002
    003import java.lang.annotation.ElementType;
    004import java.lang.annotation.Retention;
    005import java.lang.annotation.RetentionPolicy;
    006import java.lang.annotation.Target;
    007
    008/**
    009 * Condition annotation can be used instead of accept methods for parameters and
    010 * if () blocks inside infer methods.
    011 *
    012 * @author Pavel
    013 *
    014 */
    015@Target({ElementType.METHOD, ElementType.PARAMETER})
    016@Retention(RetentionPolicy.RUNTIME)
    017public @interface Condition {
    018
    019        /**
    020         * Condition definition has the following format <code>[language(parameter list)://] condition expression</code>. Default language is Java.
    021         * If language is not Java, then Extractor framework is used to look up a extractor provider to create extractor from the expression.
    022         * Parameter list is a comma separated list of parameter names, parameters not used in the condition expression can be omitted.
    023         * E.g. <code>parent, child, sibling</code> or, if <code>child</code> is not
    024         * used in the condition expression <code>parent,,sibling</code>. If parameter list is omitted, then arguments can be accessed through <code>args</code> array for
    025         * method level conditions and <code>arg</code> for parameter level conditions.
    026         * Condition expression is a fragment of Java code returning boolean.
    027         * Handler method's declaring class instance is available through <code>eCtx</code> parameter.
    028         */
    029        String[] value();
    030
    031}