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