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.Method;
17 import java.lang.reflect.Modifier;
18
19
20
21
22
23
24 public class PostConstructCallback extends LifeCycleCallback
25 {
26
27
28
29
30
31
32
33
34
35 public void validate(Class clazz, Method method)
36 {
37 if (method.getExceptionTypes().length > 0)
38 throw new IllegalArgumentException(clazz.getName()+"."+method.getName()+ " cannot not throw a checked exception");
39
40 if (!method.getReturnType().equals(Void.TYPE))
41 throw new IllegalArgumentException(clazz.getName()+"."+method.getName()+ " cannot not have a return type");
42
43 if (Modifier.isStatic(method.getModifiers()))
44 throw new IllegalArgumentException(clazz.getName()+"."+method.getName()+ " cannot be static");
45 }
46
47
48 public void callback (Object instance)
49 throws Exception
50 {
51 super.callback(instance);
52 }
53
54 public boolean equals (Object o)
55 {
56 if (super.equals(o) && (o instanceof PostConstructCallback))
57 return true;
58 return false;
59 }
60 }