View Javadoc
1   /*******************************************************************************
2    * Portions created by Sebastian Thomschke are copyright (c) 2005-2011 Sebastian
3    * Thomschke.
4    * 
5    * All Rights Reserved. This program and the accompanying materials
6    * are made available under the terms of the Eclipse Public License v1.0
7    * which accompanies this distribution, and is available at
8    * http://www.eclipse.org/legal/epl-v10.html
9    * 
10   * Contributors:
11   *     Sebastian Thomschke - initial implementation.
12   *     Chris Pheby - inspectInterfaces
13   *******************************************************************************/
14  package net.sf.oval.guard;
15  
16  import java.lang.annotation.Documented;
17  import java.lang.annotation.ElementType;
18  import java.lang.annotation.Retention;
19  import java.lang.annotation.RetentionPolicy;
20  import java.lang.annotation.Target;
21  
22  /**
23   * This annotation needs to be applied to classes where 
24   * OVal's programming by contract features shall be used.<br>
25   * <br>
26   * The GuardAspect will weave the required AOP code into all
27   * classes annotated with @Guarded.
28   * 
29   * @author Sebastian Thomschke
30   */
31  @Documented
32  @Retention(RetentionPolicy.RUNTIME)
33  @Target(ElementType.TYPE)
34  public @interface Guarded
35  {
36  	/**
37  	 * Automatically apply field constraints to the corresponding parameters of
38  	 * constructors declared within the same class.
39  	 * A corresponding parameter is a parameter with the same name and type as the field.
40  	 */
41  	boolean applyFieldConstraintsToConstructors() default false;
42  
43  	/**
44  	 * Automatically apply field constraints to the single parameter of the corresponding 
45  	 * setter methods declared within the same class.
46  	 * A corresponding setter method is a method following the JavaBean convention and
47  	 * its parameter has as the same type as the field.
48  	 */
49  	boolean applyFieldConstraintsToSetters() default false;
50  
51  	/**
52  	 * Declares if parameter values of constructors and methods are expected to be not null.
53  	 * This can be weakened by using the @net.sf.oval.constraint.exclusion.Nullable annotation on specific parameters.
54  	 */
55  	boolean assertParametersNotNull() default false;
56  
57  	/**
58  	 * Declares if invariants are automatically checked after constructor execution and 
59  	 * prior and after calls to non-private methods.
60  	 */
61  	boolean checkInvariants() default true;
62  
63  	/**
64  	 * Declares if annotations can be applied to interfaces that this class implements - supporting a documentation
65  	 * function
66  	 */
67  	boolean inspectInterfaces() default false;
68  }