001 /** 002 * Property of Hammurapi Group 003 */ 004 package com.hammurapi.review; 005 006 import java.lang.annotation.ElementType; 007 import java.lang.annotation.Retention; 008 import java.lang.annotation.RetentionPolicy; 009 import java.lang.annotation.Target; 010 011 /** 012 * This annotation indicates that method is an inspector method. 013 * 014 * Inspector methods can return facts and post facts (conclusions). Review engine 015 * needs to know types of rule outputs. From rule class introspection 016 * the rule system knows about rule method return type, but it doesn't know 017 * about types posted through <code>post()</code>. 018 * 019 * Also, return type might not be enough, as returned instances may implement 020 * interfaces which other rules are interested in, but which are not declared 021 * in the rule return type. 022 * 023 * Annotation parameter allows rules to inform the inference system about posted types. 024 * <P> 025 * For methods without fact types information provided through annotation parameter, 026 * the review system uses method return type. 027 * 028 * @author Pavel 029 * 030 */ 031 @Target(ElementType.METHOD) 032 @Retention(RetentionPolicy.RUNTIME) 033 public @interface Inspect { 034 035 /** 036 * @return Conclusion types posted by this method. 037 */ 038 Class<?>[] value() default {}; 039 040 /** 041 * @return Inspector severity. This value is overriden by the value provided in the inspector set definition. 042 */ 043 int severity() default 2; 044 045 /** 046 * @return Inspector category. Category definition in the inspector set definition file overrides this category definition. 047 */ 048 String[] category() default {}; 049 050 }