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