01: /*******************************************************************************
02: * Portions created by Sebastian Thomschke are copyright (c) 2005-2007 Sebastian
03: * Thomschke.
04: *
05: * All Rights Reserved. This program and the accompanying materials
06: * are made available under the terms of the Eclipse Public License v1.0
07: * which accompanies this distribution, and is available at
08: * http://www.eclipse.org/legal/epl-v10.html
09: *
10: * Contributors:
11: * Sebastian Thomschke - initial implementation.
12: *******************************************************************************/package net.sf.oval.guard;
13:
14: import java.lang.annotation.Documented;
15: import java.lang.annotation.ElementType;
16: import java.lang.annotation.Retention;
17: import java.lang.annotation.RetentionPolicy;
18: import java.lang.annotation.Target;
19:
20: /**
21: * After the annotated method has been executed the condition is evaluated.<br>
22: * <br>
23: * In case of constraint violations the method will throw an ConstraintsViolatedException.
24: *
25: * @author Sebastian Thomschke
26: */
27: @Documented
28: @Retention(RetentionPolicy.RUNTIME)
29: @Target({ElementType.METHOD})
30: public @interface Post {
31: /**
32: * error code passed to the ConstraintViolation object
33: */
34: String errorCode() default "net.sf.oval.guard.Post";
35:
36: /**
37: * Formula in the given expression language describing the constraint. the formula must return true if the constraint is satisfied.
38: * <br>
39: * available variables are:<br>
40: * <b>_args[]</b> -> the current parameter values<br>
41: * <b>_old</b> -> the old values<br>
42: * <b>_returns</b> -> the method's return value
43: * <b>_this</b> -> the validated bean<br>
44: * additionally variables named accordingly to the parameters are available<br>
45: */
46: String expr();
47:
48: /**
49: * the expression language that is used
50: */
51: String lang();
52:
53: /**
54: * message to be used for the ContraintsViolatedException
55: *
56: * @see net.sf.oval.exception.ConstraintsViolatedException
57: */
58: String message() default "net.sf.oval.guard.Post.violated";
59:
60: /**
61: * Formula that is evaluated prior method execution.<br>
62: * The returned value can later be accessed in the constraint expression via the variable <b>_old</b>
63: */
64: String old() default "";
65:
66: /**
67: * The associated validation profiles.
68: */
69: String[] profiles() default {};
70:
71: /**
72: * severity passed to the ConstraintViolation object
73: */
74: int severity() default 0;
75: }
|