View Javadoc
1   /*
2    * Copyright 2016 The Netty Project
3    *
4    * The Netty Project licenses this file to you under the Apache License,
5    * version 2.0 (the "License"); you may not use this file except in compliance
6    * with the License. You may obtain a copy of the License at:
7    *
8    *   https://www.apache.org/licenses/LICENSE-2.0
9    *
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12   * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13   * License for the specific language governing permissions and limitations
14   * under the License.
15   */
16  package io.netty5.channel.kqueue;
17  
18  import io.netty5.util.internal.UnstableApi;
19  
20  import static java.util.Objects.requireNonNull;
21  
22  @UnstableApi
23  public final class AcceptFilter {
24      static final AcceptFilter PLATFORM_UNSUPPORTED = new AcceptFilter("", "");
25      private final String filterName;
26      private final String filterArgs;
27  
28      public AcceptFilter(String filterName, String filterArgs) {
29          this.filterName = requireNonNull(filterName, "filterName");
30          this.filterArgs = requireNonNull(filterArgs, "filterArgs");
31      }
32  
33      public String filterName() {
34          return filterName;
35      }
36  
37      public String filterArgs() {
38          return filterArgs;
39      }
40  
41      @Override
42      public boolean equals(Object o) {
43          if (o == this) {
44              return true;
45          }
46          if (!(o instanceof AcceptFilter)) {
47              return false;
48          }
49          AcceptFilter rhs = (AcceptFilter) o;
50          return filterName.equals(rhs.filterName) && filterArgs.equals(rhs.filterArgs);
51      }
52  
53      @Override
54      public int hashCode() {
55          return 31 * (31 + filterName.hashCode()) + filterArgs.hashCode();
56      }
57  
58      @Override
59      public String toString() {
60          return filterName + ", " + filterArgs;
61      }
62  }