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 WebsocketChannelMetadata implements Serializable
29  {
30      private String channel;
31      
32      private String scope;
33      
34      private Serializable user;
35      
36      private boolean connected;
37  
38      public WebsocketChannelMetadata(String channel, String scope, Serializable user, boolean connected)
39      {
40          this.channel = channel;
41          this.scope = scope;
42          this.user = user;
43          this.connected = connected;
44      }
45  
46      public WebsocketChannelMetadata()
47      {
48      }
49  
50      /**
51       * @return the channel
52       */
53      public String getChannel()
54      {
55          return channel;
56      }
57  
58      /**
59       * @param channel the channel to set
60       */
61      public void setChannel(String channel)
62      {
63          this.channel = channel;
64      }
65  
66      /**
67       * @return the scope
68       */
69      public String getScope()
70      {
71          return scope;
72      }
73  
74      /**
75       * @param scope the scope to set
76       */
77      public void setScope(String scope)
78      {
79          this.scope = scope;
80      }
81  
82      /**
83       * @return the user
84       */
85      public Serializable getUser()
86      {
87          return user;
88      }
89  
90      /**
91       * @param user the user to set
92       */
93      public void setUser(Serializable user)
94      {
95          this.user = user;
96      }
97  
98      /**
99       * @return the connected
100      */
101     public boolean isConnected()
102     {
103         return connected;
104     }
105 
106     /**
107      * @param connected the connected to set
108      */
109     public void setConnected(boolean connected)
110     {
111         this.connected = connected;
112     }
113 
114     @Override
115     public int hashCode()
116     {
117         int hash = 5;
118         hash = 67 * hash + Objects.hashCode(this.channel);
119         hash = 67 * hash + Objects.hashCode(this.scope);
120         hash = 67 * hash + Objects.hashCode(this.user);
121         hash = 67 * hash + (this.connected ? 1 : 0);
122         return hash;
123     }
124 
125     @Override
126     public boolean equals(Object obj)
127     {
128         if (obj == null)
129         {
130             return false;
131         }
132         if (getClass() != obj.getClass())
133         {
134             return false;
135         }
136         final WebsocketChannelMetadata other = (WebsocketChannelMetadata) obj;
137         if (!Objects.equals(this.channel, other.channel))
138         {
139             return false;
140         }
141         if (!Objects.equals(this.scope, other.scope))
142         {
143             return false;
144         }
145         if (!Objects.equals(this.user, other.user))
146         {
147             return false;
148         }
149         if (this.connected != other.connected)
150         {
151             return false;
152         }
153         return true;
154     }
155 
156 }