View Javadoc
1   /*
2    * Copyright 2015 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.handler.codec.dns;
17  
18  import io.netty5.util.internal.UnstableApi;
19  
20  /**
21   * The default {@link DnsQuery} implementation.
22   */
23  @UnstableApi
24  public class DefaultDnsQuery extends AbstractDnsMessage implements DnsQuery {
25  
26      /**
27       * Creates a new instance with the {@link DnsOpCode#QUERY} {@code opCode}.
28       *
29       * @param id the {@code ID} of the DNS query
30       */
31      public DefaultDnsQuery(int id) {
32          super(id);
33      }
34  
35      /**
36       * Creates a new instance.
37       *
38       * @param id the {@code ID} of the DNS query
39       * @param opCode the {@code opCode} of the DNS query
40       */
41      public DefaultDnsQuery(int id, DnsOpCode opCode) {
42          super(id, opCode);
43      }
44  
45      @Override
46      public DnsQuery setId(int id) {
47          return (DnsQuery) super.setId(id);
48      }
49  
50      @Override
51      public DnsQuery setOpCode(DnsOpCode opCode) {
52          return (DnsQuery) super.setOpCode(opCode);
53      }
54  
55      @Override
56      public DnsQuery setRecursionDesired(boolean recursionDesired) {
57          return (DnsQuery) super.setRecursionDesired(recursionDesired);
58      }
59  
60      @Override
61      public DnsQuery setZ(int z) {
62          return (DnsQuery) super.setZ(z);
63      }
64  
65      @Override
66      public DnsQuery setRecord(DnsSection section, DnsRecord record) {
67          return (DnsQuery) super.setRecord(section, record);
68      }
69  
70      @Override
71      public DnsQuery addRecord(DnsSection section, DnsRecord record) {
72          return (DnsQuery) super.addRecord(section, record);
73      }
74  
75      @Override
76      public DnsQuery addRecord(DnsSection section, int index, DnsRecord record) {
77          return (DnsQuery) super.addRecord(section, index, record);
78      }
79  
80      @Override
81      public DnsQuery clear(DnsSection section) {
82          return (DnsQuery) super.clear(section);
83      }
84  
85      @Override
86      public DnsQuery clear() {
87          return (DnsQuery) super.clear();
88      }
89  
90      @Override
91      public DnsQuery touch() {
92          return (DnsQuery) super.touch();
93      }
94  
95      @Override
96      public DnsQuery touch(Object hint) {
97          return (DnsQuery) super.touch(hint);
98      }
99  
100     @Override
101     public DnsQuery retain() {
102         return (DnsQuery) super.retain();
103     }
104 
105     @Override
106     public DnsQuery retain(int increment) {
107         return (DnsQuery) super.retain(increment);
108     }
109 
110     @Override
111     public String toString() {
112         return DnsMessageUtil.appendQuery(new StringBuilder(128), this).toString();
113     }
114 }