KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > spoon > aval > annotations > jwsValImpl > ValidWebOperationValidator


1 package spoon.aval.annotations.jwsValImpl;
2
3 import spoon.aval.Validator;
4 import spoon.aval.annotations.jwsVal.ValidWebOperation;
5 import spoon.aval.processing.ValidationPoint;
6 import spoon.processing.Severity;
7 import spoon.reflect.declaration.CtMethod;
8 import spoon.reflect.declaration.ModifierKind;
9
10 public class ValidWebOperationValidator implements Validator<ValidWebOperation> {
11
12     public void check(ValidationPoint<ValidWebOperation> vp) {
13         if (vp.getProgramElement() instanceof CtMethod) {
14             CtMethod<?> webOp = (CtMethod<?>) vp.getProgramElement();
15             if (!webOp.hasModifier(ModifierKind.PUBLIC)) {
16                 ValidationPoint.report(Severity.ERROR, webOp,
17                         "WebMethods should be public");
18             }
19         }
20     }
21
22 }
23
Popular Tags