Skip to content

Package: StoreEvent

StoreEvent

nameinstructionbranchcomplexitylinemethod
StoreEvent(Store, int, String)
M: 10 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 4 C: 0
0%
M: 1 C: 0
0%
dispatch(Object)
M: 5 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 2 C: 0
0%
M: 1 C: 0
0%
getMessage()
M: 3 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%
getMessageType()
M: 3 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%

Coverage

1: /*
2: * Copyright (c) 1997, 2023 Oracle and/or its affiliates. All rights reserved.
3: *
4: * This program and the accompanying materials are made available under the
5: * terms of the Eclipse Public License v. 2.0, which is available at
6: * http://www.eclipse.org/legal/epl-2.0.
7: *
8: * This Source Code may also be made available under the following Secondary
9: * Licenses when the conditions for such availability set forth in the
10: * Eclipse Public License v. 2.0 are satisfied: GNU General Public License,
11: * version 2 with the GNU Classpath Exception, which is available at
12: * https://www.gnu.org/software/classpath/license.html.
13: *
14: * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
15: */
16:
17: package jakarta.mail.event;
18:
19: import jakarta.mail.Store;
20:
21: /**
22: * This class models notifications from the Store connection. These
23: * notifications can be ALERTS or NOTICES. ALERTS must be presented
24: * to the user in a fashion that calls the user's attention to the
25: * message.
26: *
27: * @author John Mani
28: */
29:
30: public class StoreEvent extends MailEvent {
31:
32: /**
33: * Indicates that this message is an ALERT.
34: */
35: public static final int ALERT = 1;
36:
37: /**
38: * Indicates that this message is a NOTICE.
39: */
40: public static final int NOTICE = 2;
41:
42: /**
43: * The event type.
44: *
45: * @serial
46: */
47: protected int type;
48:
49: /**
50: * The message text to be presented to the user.
51: *
52: * @serial
53: */
54: protected String message;
55:
56: private static final long serialVersionUID = 1938704919992515330L;
57:
58: /**
59: * Construct a StoreEvent.
60: *
61: * @param store the source Store
62: * @param type the event type
63: * @param message a message assoicated with the event
64: */
65: public StoreEvent(Store store, int type, String message) {
66: super(store);
67: this.type = type;
68: this.message = message;
69: }
70:
71: /**
72: * Return the type of this event.
73: *
74: * @return type
75: * @see #ALERT
76: * @see #NOTICE
77: */
78: public int getMessageType() {
79: return type;
80: }
81:
82: /**
83: * Get the message from the Store.
84: *
85: * @return message from the Store
86: */
87: public String getMessage() {
88: return message;
89: }
90:
91: /**
92: * Invokes the appropriate StoreListener method.
93: */
94: @Override
95: public void dispatch(Object listener) {
96: ((StoreListener) listener).notification(this);
97: }
98: }