package com.hammurapi.common;

import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

/**
 * Condition annotation can be used instead of accept methods for parameters and
 * if () blocks inside infer methods.
 * 
 * @author Pavel
 *
 */
@Target({ElementType.METHOD, ElementType.PARAMETER})
@Retention(RetentionPolicy.RUNTIME)
public @interface Condition {
	
	/**
	 * Condition definition has the following format <code>[language(parameter list)://] condition expression</code>. Default language is Java.
	 * If language is not Java, then Extractor framework is used to look up a extractor provider to create extractor from the expression.
	 * Parameter list is a comma separated list of parameter names, parameters not used in the condition expression can be omitted. 
	 * E.g. <code>parent, child, sibling</code> or, if <code>child</code> is not 
	 * 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
	 * method level conditions and <code>arg</code> for parameter level conditions.
	 * Condition expression is a fragment of Java code returning boolean. 
	 * Handler method's declaring class instance is available through <code>eCtx</code> parameter. 
	 */
	String[] value();
		
}
