1 /*
2  * Licensed to the Apache Software Foundation (ASF) under one or more
3  * contributor license agreements.  See the NOTICE file distributed with
4  * this work for additional information regarding copyright ownership.
5  * The ASF licenses this file to You under the Apache License, Version 2.0
6  * (the "License"); you may not use this file except in compliance with
7  * the License.  You may obtain a copy of the License at
8  *
9  *     http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  */
17 package javax.websocket;
18 
19 import java.util.List;
20 import java.util.Map;
21 import java.util.concurrent.ConcurrentHashMap;
22 
23 final class DefaultClientEndpointConfig implements ClientEndpointConfig {
24 
25     private final List<String> preferredSubprotocols;
26     private final List<Extension> extensions;
27     private final List<Class<? extends Encoder>> encoders;
28     private final List<Class<? extends Decoder>> decoders;
29     private final Map<String,Object> userProperties = new ConcurrentHashMap<>();
30     private final Configurator configurator;
31 
32 
DefaultClientEndpointConfig(List<String> preferredSubprotocols, List<Extension> extensions, List<Class<? extends Encoder>> encoders, List<Class<? extends Decoder>> decoders, Configurator configurator)33     DefaultClientEndpointConfig(List<String> preferredSubprotocols,
34             List<Extension> extensions,
35             List<Class<? extends Encoder>> encoders,
36             List<Class<? extends Decoder>> decoders,
37             Configurator configurator) {
38         this.preferredSubprotocols = preferredSubprotocols;
39         this.extensions = extensions;
40         this.decoders = decoders;
41         this.encoders = encoders;
42         this.configurator = configurator;
43     }
44 
45 
46     @Override
getPreferredSubprotocols()47     public List<String> getPreferredSubprotocols() {
48         return preferredSubprotocols;
49     }
50 
51 
52     @Override
getExtensions()53     public List<Extension> getExtensions() {
54         return extensions;
55     }
56 
57 
58     @Override
getEncoders()59     public List<Class<? extends Encoder>> getEncoders() {
60         return encoders;
61     }
62 
63 
64     @Override
getDecoders()65     public List<Class<? extends Decoder>> getDecoders() {
66         return decoders;
67     }
68 
69 
70     @Override
getUserProperties()71     public final Map<String, Object> getUserProperties() {
72         return userProperties;
73     }
74 
75 
76     @Override
getConfigurator()77     public Configurator getConfigurator() {
78         return configurator;
79     }
80 }
81