1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20 package org.apache.myfaces.config.annotation;
21
22 import javax.annotation.PostConstruct;
23 import javax.annotation.PreDestroy;
24
25
26
27
28
29 class AnnotatedManagedBean {
30
31 private boolean postConstructCalled = false;
32
33 private boolean preDestroyCalled = false;
34
35 boolean throwExcetion;
36
37
38 public AnnotatedManagedBean()
39 {
40 }
41
42 public AnnotatedManagedBean(boolean throwExcetion) {
43 this.throwExcetion = throwExcetion;
44 }
45
46 @PostConstruct
47 public void postConstruct() {
48 postConstructCalled = true;
49
50 if (throwExcetion) {
51 throw new RuntimeException();
52 }
53 }
54
55 @PreDestroy
56 public void preDestroy() {
57 preDestroyCalled = true;
58
59 if (throwExcetion) {
60 throw new RuntimeException();
61 }
62 }
63
64 boolean isPostConstructCalled() {
65 return postConstructCalled;
66 }
67
68 boolean isPreDestroyCalled() {
69 return preDestroyCalled;
70 }
71
72 }