1
2
3
4
5
6
7
8
9
10
11
12
13
14 package org.eclipse.jetty.plus.annotation;
15
16 import java.lang.reflect.InvocationTargetException;
17 import java.lang.reflect.Method;
18 import java.lang.reflect.Modifier;
19
20
21
22
23
24
25 public class PostConstructCallback extends LifeCycleCallback
26 {
27
28
29
30
31
32
33
34
35
36 public void validate(Class clazz, Method method)
37 {
38 if (method.getExceptionTypes().length > 0)
39 throw new IllegalArgumentException(clazz.getName()+"."+method.getName()+ " cannot not throw a checked exception");
40
41 if (!method.getReturnType().equals(Void.TYPE))
42 throw new IllegalArgumentException(clazz.getName()+"."+method.getName()+ " cannot not have a return type");
43
44 if (Modifier.isStatic(method.getModifiers()))
45 throw new IllegalArgumentException(clazz.getName()+"."+method.getName()+ " cannot be static");
46 }
47
48
49 public void callback (Object instance)
50 throws SecurityException, IllegalArgumentException, NoSuchMethodException, ClassNotFoundException, IllegalAccessException, InvocationTargetException
51 {
52 super.callback(instance);
53 }
54
55 public boolean equals (Object o)
56 {
57 if (super.equals(o) && (o instanceof PostConstructCallback))
58 return true;
59 return false;
60 }
61 }