1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 package jakarta.faces.event;
20
21 import jakarta.faces.lifecycle.Lifecycle;
22 import jakarta.faces.context.FacesContext;
23
24 import java.util.EventObject;
25
26
27
28
29 public class PhaseEvent extends EventObject
30 {
31 private static final long serialVersionUID = -7235692965954486239L;
32
33 private FacesContext _facesContext;
34 private PhaseId _phaseId;
35
36
37 public PhaseEvent(FacesContext facesContext, PhaseId phaseId, Lifecycle lifecycle)
38 {
39 super(lifecycle);
40 if (facesContext == null)
41 {
42 throw new NullPointerException("facesContext");
43 }
44 if (phaseId == null)
45 {
46 throw new NullPointerException("phaseId");
47 }
48 if (lifecycle == null)
49 {
50 throw new NullPointerException("lifecycle");
51 }
52
53 _facesContext = facesContext;
54 _phaseId = phaseId;
55 }
56
57
58 public FacesContext getFacesContext()
59 {
60 return _facesContext;
61 }
62
63 public PhaseId getPhaseId()
64 {
65 return _phaseId;
66 }
67
68 @Override
69 public int hashCode()
70 {
71 int prime = 31;
72 int result = 1;
73 result = prime * result + ((source == null) ? 0 : source.hashCode());
74 result = prime * result + ((_facesContext == null) ? 0 : _facesContext.hashCode());
75 result = prime * result + ((_phaseId == null) ? 0 : _phaseId.hashCode());
76 return result;
77 }
78
79 @Override
80 public boolean equals(Object obj)
81 {
82 if (this == obj)
83 {
84 return true;
85 }
86 if (obj == null)
87 {
88 return false;
89 }
90 if (getClass() != obj.getClass())
91 {
92 return false;
93 }
94 PhaseEvent other = (PhaseEvent) obj;
95 if (source == null)
96 {
97 if (other.source != null)
98 {
99 return false;
100 }
101 }
102 else if (!source.equals(other.source))
103 {
104 return false;
105 }
106 if (_facesContext == null)
107 {
108 if (other._facesContext != null)
109 {
110 return false;
111 }
112 }
113 else if (!_facesContext.equals(other._facesContext))
114 {
115 return false;
116 }
117 if (_phaseId == null)
118 {
119 if (other._phaseId != null)
120 {
121 return false;
122 }
123 }
124 else if (!_phaseId.equals(other._phaseId))
125 {
126 return false;
127 }
128 return true;
129 }
130
131 }