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, 2021 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 java.util.*;
20: import jakarta.mail.*;
21:
22: /**
23: * This class models notifications from the Store connection. These
24: * notifications can be ALERTS or NOTICES. ALERTS must be presented
25: * to the user in a fashion that calls the user's attention to the
26: * message.
27: *
28: * @author John Mani
29: */
30:
31: public class StoreEvent extends MailEvent {
32:
33: /**
34: * Indicates that this message is an ALERT.
35: */
36: public static final int ALERT                 = 1;
37:
38: /**
39: * Indicates that this message is a NOTICE.
40: */
41: public static final int NOTICE                 = 2;
42:
43: /**
44: * The event type.
45: *
46: * @serial
47: */
48: protected int type;
49:
50: /**
51: * The message text to be presented to the user.
52: *
53: * @serial
54: */
55: protected String message;
56:
57: private static final long serialVersionUID = 1938704919992515330L;
58:
59: /**
60: * Construct a StoreEvent.
61: *
62: * @param        store        the source Store
63: * @param        type        the event type
64: * @param        message        a message assoicated with the event
65: */
66: public StoreEvent(Store store, int type, String message) {
67:         super(store);
68:         this.type = type;
69:         this.message = message;
70: }
71:
72: /**
73: * Return the type of this event.
74: *
75: * @return type
76: * @see #ALERT
77: * @see #NOTICE
78: */
79: public int getMessageType() {
80:         return type;
81: }
82:
83: /**
84: * Get the message from the Store.
85: *
86: * @return message from the Store
87: */
88: public String getMessage() {
89:         return message;
90: }
91:
92: /**
93: * Invokes the appropriate StoreListener method.
94: */
95: @Override
96: public void dispatch(Object listener) {
97:         ((StoreListener)listener).notification(this);
98: }
99: }