View Javadoc

1   /*
2    * Licensed to the Apache Software Foundation (ASF) under one
3    * or more contributor license agreements.  See the NOTICE file
4    * distributed with this work for additional information
5    * regarding copyright ownership.  The ASF licenses this file
6    * to you under the Apache License, Version 2.0 (the
7    * "License"); you may not use this file except in compliance
8    * with the License.  You may obtain a copy of the License at
9    *
10   *   http://www.apache.org/licenses/LICENSE-2.0
11   *
12   * Unless required by applicable law or agreed to in writing,
13   * software distributed under the License is distributed on an
14   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15   * KIND, either express or implied.  See the License for the
16   * specific language governing permissions and limitations
17   * under the License.
18   */
19  
20  package org.apache.myfaces.push.cdi;
21  
22  import java.io.Serializable;
23  import java.util.Objects;
24  
25  /**
26   *
27   */
28  public class WebsocketChannel implements Serializable
29  {
30      private String channelToken;
31      
32      private WebsocketChannelMetadata metadata;
33  
34      public WebsocketChannel(String channelToken, WebsocketChannelMetadata metadata)
35      {
36          this.channelToken = channelToken;
37          this.metadata = metadata;
38      }
39  
40      public WebsocketChannel()
41      {
42      }
43  
44      public String getChannelToken()
45      {
46          return channelToken;
47      }
48  
49      public String getScope()
50      {
51          return metadata.getScope();
52      }
53  
54      public Serializable getUser()
55      {
56          return metadata.getUser();
57      }
58  
59      /**
60       * @return the channel
61       */
62      public String getChannel()
63      {
64          return metadata.getChannel();
65      }
66  
67      @Override
68      public int hashCode()
69      {
70          int hash = 7;
71          hash = 83 * hash + Objects.hashCode(this.channelToken);
72          hash = 83 * hash + Objects.hashCode(this.metadata);
73          return hash;
74      }
75  
76      @Override
77      public boolean equals(Object obj)
78      {
79          if (obj == null)
80          {
81              return false;
82          }
83          if (getClass() != obj.getClass())
84          {
85              return false;
86          }
87          final WebsocketChannel other = (WebsocketChannel) obj;
88          if (!Objects.equals(this.channelToken, other.channelToken))
89          {
90              return false;
91          }
92          if (!Objects.equals(this.metadata, other.metadata))
93          {
94              return false;
95          }
96          return true;
97      }
98      
99  }