Skip to content

Package: Provider

Provider

nameinstructionbranchcomplexitylinemethod
Provider(Provider.Type, String, String, String, String)
M: 18 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 7 C: 0
0%
M: 1 C: 0
0%
getClassName()
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%
getProtocol()
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%
getType()
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%
getVendor()
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%
getVersion()
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%
toString()
M: 61 C: 0
0%
M: 4 C: 0
0%
M: 3 C: 0
0%
M: 7 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;
18:
19: /**
20: * The Provider is a class that describes a protocol
21: * implementation. The values typically come from the
22: * javamail.providers and javamail.default.providers
23: * resource files. An application may also create and
24: * register a Provider object to dynamically add support
25: * for a new provider.
26: *
27: * @author Max Spivak
28: * @author Bill Shannon
29: */
30: public class Provider {
31:
32: /**
33: * This inner class defines the Provider type.
34: * Currently, STORE and TRANSPORT are the only two provider types
35: * supported.
36: */
37:
38: public static class Type {
39: public static final Type STORE = new Type("STORE");
40: public static final Type TRANSPORT = new Type("TRANSPORT");
41:
42: private String type;
43:
44: private Type(String type) {
45: this.type = type;
46: }
47:
48: @Override
49: public String toString() {
50: return type;
51: }
52: }
53:
54: private Type type;
55: private String protocol, className, vendor, version;
56:
57: /**
58: * Create a new provider of the specified type for the specified
59: * protocol. The specified class implements the provider.
60: *
61: * @param type Type.STORE or Type.TRANSPORT
62: * @param protocol valid protocol for the type
63: * @param classname class name that implements this protocol
64: * @param vendor optional string identifying the vendor (may be null)
65: * @param version optional implementation version string (may be null)
66: * @since JavaMail 1.4
67: */
68: public Provider(Type type, String protocol, String classname,
69: String vendor, String version) {
70: this.type = type;
71: this.protocol = protocol;
72: this.className = classname;
73: this.vendor = vendor;
74: this.version = version;
75: }
76:
77: /**
78: * Returns the type of this Provider.
79: *
80: * @return the provider type
81: */
82: public Type getType() {
83: return type;
84: }
85:
86: /**
87: * Returns the protocol supported by this Provider.
88: *
89: * @return the protocol
90: */
91: public String getProtocol() {
92: return protocol;
93: }
94:
95: /**
96: * Returns the name of the class that implements the protocol.
97: *
98: * @return the class name
99: */
100: public String getClassName() {
101: return className;
102: }
103:
104: /**
105: * Returns the name of the vendor associated with this implementation
106: * or null.
107: *
108: * @return the vendor
109: */
110: public String getVendor() {
111: return vendor;
112: }
113:
114: /**
115: * Returns the version of this implementation or null if no version.
116: *
117: * @return the version
118: */
119: public String getVersion() {
120: return version;
121: }
122:
123: /**
124: * Overrides Object.toString()
125: */
126: @Override
127: public String toString() {
128: String s = "jakarta.mail.Provider[" + type + "," +
129: protocol + "," + className;
130:
131:• if (vendor != null)
132: s += "," + vendor;
133:
134:• if (version != null)
135: s += "," + version;
136:
137: s += "]";
138: return s;
139: }
140: }