Skip to content

Package: DefaultClientEndpointConfig

DefaultClientEndpointConfig

nameinstructionbranchcomplexitylinemethod
DefaultClientEndpointConfig(List, List, List, List, ClientEndpointConfig.Configurator)
M: 27 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 8 C: 0
0%
M: 1 C: 0
0%
getConfigurator()
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%
getDecoders()
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%
getEncoders()
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%
getExtensions()
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%
getPreferredSubprotocols()
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%
getUserProperties()
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) 2018, 2020 Oracle and/or its affiliates and others.
3: * All rights reserved.
4: *
5: * This program and the accompanying materials are made available under the
6: * terms of the Eclipse Public License v. 2.0, which is available at
7: * http://www.eclipse.org/legal/epl-2.0.
8: *
9: * This Source Code may also be made available under the following Secondary
10: * Licenses when the conditions for such availability set forth in the
11: * Eclipse Public License v. 2.0 are satisfied: GNU General Public License,
12: * version 2 with the GNU Classpath Exception, which is available at
13: * https://www.gnu.org/software/classpath/license.html.
14: *
15: * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
16: */
17:
18: package jakarta.websocket;
19:
20: import java.util.Collections;
21: import java.util.HashMap;
22: import java.util.List;
23: import java.util.Map;
24:
25: /**
26: * The DefaultClientEndpointConfig is a concrete implementation of a client configuration.
27: *
28: * @author dannycoward
29: */
30: final class DefaultClientEndpointConfig implements ClientEndpointConfig {
31: private List<String> preferredSubprotocols;
32: private List<Extension> extensions;
33: private List<Class<? extends Encoder>> encoders;
34: private List<Class<? extends Decoder>> decoders;
35: private Map<String, Object> userProperties = new HashMap<>();
36: private ClientEndpointConfig.Configurator clientEndpointConfigurator;
37:
38: DefaultClientEndpointConfig(List<String> preferredSubprotocols, List<Extension> extensions,
39: List<Class<? extends Encoder>> encoders, List<Class<? extends Decoder>> decoders,
40: ClientEndpointConfig.Configurator clientEndpointConfigurator) {
41: this.preferredSubprotocols = Collections.unmodifiableList(preferredSubprotocols);
42: this.extensions = Collections.unmodifiableList(extensions);
43: this.encoders = Collections.unmodifiableList(encoders);
44: this.decoders = Collections.unmodifiableList(decoders);
45: this.clientEndpointConfigurator = clientEndpointConfigurator;
46: }
47:
48: /**
49: * Return the protocols, in order of preference, favorite first, that this client would like to use for its
50: * sessions.
51: *
52: * @return the preferred subprotocols.
53: */
54: @Override
55: public List<String> getPreferredSubprotocols() {
56: return this.preferredSubprotocols;
57: }
58:
59: /**
60: * Return the extensions, in order of preference, favorite first, that this client would like to use for its
61: * sessions.
62: *
63: * @return the (unmodifiable) extension list.
64: */
65: @Override
66: public List<Extension> getExtensions() {
67: return this.extensions;
68: }
69:
70: /**
71: * Return the (unmodifiable) list of encoders this client will use.
72: *
73: * @return the encoder list.
74: */
75: @Override
76: public List<Class<? extends Encoder>> getEncoders() {
77: return this.encoders;
78: }
79:
80: /**
81: * Return the (unmodifiable) list of decoders this client will use.
82: *
83: * @return the decoders to use.
84: */
85: @Override
86: public List<Class<? extends Decoder>> getDecoders() {
87: return this.decoders;
88: }
89:
90: /**
91: * Editable map of user properties.
92: */
93: @Override
94: public final Map<String, Object> getUserProperties() {
95: return this.userProperties;
96: }
97:
98: @Override
99: public ClientEndpointConfig.Configurator getConfigurator() {
100: return this.clientEndpointConfigurator;
101: }
102:
103: }