com.h3c.util.pkt

## Class Dns.Builder

- java.lang.Object
- - com.h3c.util.pkt.Dns.Builder

- Enclosing class:
    Dns

      public static class Dns.Builder
      extends Object

  Builder (mutable) used to create new protocol instances.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `Dns.Builder()` Create a new builder using the defaults:
    `Dns.Builder(Dns dns)` Copy constructor builder initialized from the passed in protocol.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `<T> Dns.Builder` | `additional(String name, Dns.RecordType rt, int ttl, T d)` Sets the additionals array for a single resource record.
    `Dns.Builder` | `additionals(Dns.ResRecord<?>... additionals)` Sets the additionals array.
    `<T> Dns.Builder` | `answer(String name, Dns.RecordType rt, int ttl, T d)` Sets the answers array for a single resource record.
    `Dns.Builder` | `answers(Dns.ResRecord<?>... answers)` Sets the answers array.
    `Dns.Builder` | `authData(boolean authData)` Sets whether the response data is authorized.
    `Dns.Builder` | `authorities(Dns.ResRecord<?>... authorities)` Sets the authorities array.
    `<T> Dns.Builder` | `authority(String name, Dns.RecordType rt, int ttl, T d)` Sets the authorities array for a single resource record.
    `Dns` | `build()` Creates a new protocol instance from this builder.
    `Dns.Builder` | `checkDisabled(boolean checkDisabled)` Sets the check disabled flag.
    `Dns.Builder` | `opCode(Dns.OpCode opCode)` Sets the opcode.
    `Dns.Builder` | `queries(Dns.Record... queries)` Sets the queries array.
    `Dns.Builder` | `query(boolean query)` Sets the query flag.
    `Dns.Builder` | `query(String name, Dns.RecordType rt)` Sets up the query array for a single name query.
    `Dns.Builder` | `recurDesired(boolean recurDesired)` Specifies whether recursion is desired for a query.
    `Dns.Builder` | `respCode(Dns.ResponseCode respCode)` Sets the response code.
    `Dns.Builder` | `responderAuth(boolean responderAuth)` Sets the authoritative flag.
    `Dns.Builder` | `responseFor(Dns query)` A convenience method to construct a response object for the given query.
    `Dns.Builder` | `svrRecurAvail(boolean svrRecurAvail)` Sets whether recursion is available on the server.
    `Dns.Builder` | `trunc(boolean trunc)` Sets the truncated flag.
    `Dns.Builder` | `txId(int txId)` Sets the transaction ID.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### Dns.Builder

          public Dns.Builder()

      Create a new builder using the defaults:

           txId = 0
           query = false
           opCode = QUERY
           responderAuth = false
           trunc = false
           recurDesired = false
           svrRecurAvail = false
           authData = false
           checkDisabled = false
           retCode = NO_ERROR
           queries = NO_REQUESTS
           answers = NO_RESPONSES
           authorities = NO_RESPONSES
           additionals = NO_RESPONSES

    - #### Dns.Builder

          public Dns.Builder(Dns dns)

      Copy constructor builder initialized from the passed in protocol.
      Parameters:
        `dns` - builder is initialed from this protocol's data

  - ### Method Detail

    - #### build

          public Dns build()

      Creates a new protocol instance from this builder.
      Returns:
        the new protocol instance

    - #### txId

          public Dns.Builder txId(int txId)

      Sets the transaction ID.
      Parameters:
        `txId` - the transaction ID of this query or response
      Returns:
        this instance

    - #### query

          public Dns.Builder query(boolean query)

      Sets the query flag.
      Parameters:
        `query` - the query flag.
      Returns:
        this instance

    - #### opCode

          public Dns.Builder opCode(Dns.OpCode opCode)

      Sets the opcode.
      Parameters:
        `opCode` - the DNS opcode
      Returns:
        this instance

    - #### responderAuth

          public Dns.Builder responderAuth(boolean responderAuth)

      Sets the authoritative flag. This is only meaningful in a response.
      Parameters:
        `responderAuth` - the responder authoritative flag
      Returns:
        this instance

    - #### trunc

          public Dns.Builder trunc(boolean trunc)

      Sets the truncated flag.
      Parameters:
        `trunc` - the truncated flag
      Returns:
        this instance

    - #### recurDesired

          public Dns.Builder recurDesired(boolean recurDesired)

      Specifies whether recursion is desired for a query.
      Parameters:
        `recurDesired` - the recursion is desired flag
      Returns:
        this instance

    - #### svrRecurAvail

          public Dns.Builder svrRecurAvail(boolean svrRecurAvail)

      Sets whether recursion is available on the server.
      Parameters:
        `svrRecurAvail` - the server recursion is available flag
      Returns:
        this instance

    - #### authData

          public Dns.Builder authData(boolean authData)

      Sets whether the response data is authorized.
      Parameters:
        `authData` - the response data is authorized flag
      Returns:
        this instance

    - #### checkDisabled

          public Dns.Builder checkDisabled(boolean checkDisabled)

      Sets the check disabled flag.
      Parameters:
        `checkDisabled` - the check disabled flag
      Returns:
        this instance

    - #### respCode

          public Dns.Builder respCode(Dns.ResponseCode respCode)

      Sets the response code.
      Parameters:
        `respCode` - the response code
      Returns:
        this instance

    - #### queries

          public Dns.Builder queries(Dns.Record... queries)

      Sets the queries array.
      Parameters:
        `queries` - array of query requests
      Returns:
        this instance

    - #### query

          public Dns.Builder query(String name,
                          Dns.RecordType rt)

      Sets up the query array for a single name query.
      Parameters:
        `name` - the name text to query
        `rt` - the record type
      Returns:
        this instance

    - #### answers

          public Dns.Builder answers(Dns.ResRecord<?>... answers)

      Sets the answers array.
      Parameters:
        `answers` - array of answers responses
      Returns:
        this instance

    - #### answer

          public <T> Dns.Builder answer(String name,
                               Dns.RecordType rt,
                               int ttl,
                               T d)

      Sets the answers array for a single resource record.
      Parameters:
        `name` - the name text
        `rt` - the resource record type
        `ttl` - the time to live in seconds
        `d` - the resource data
      Returns:
        this instance

    - #### authorities

          public Dns.Builder authorities(Dns.ResRecord<?>... authorities)

      Sets the authorities array.
      Parameters:
        `authorities` - array of authority responses
      Returns:
        this instance

    - #### authority

          public <T> Dns.Builder authority(String name,
                                  Dns.RecordType rt,
                                  int ttl,
                                  T d)

      Sets the authorities array for a single resource record.
      Parameters:
        `name` - the name text
        `rt` - the resource record type
        `ttl` - the time to live in seconds
        `d` - the resource data
      Returns:
        this instance

    - #### additionals

          public Dns.Builder additionals(Dns.ResRecord<?>... additionals)

      Sets the additionals array.
      Parameters:
        `additionals` - array of additional responses
      Returns:
        this instance

    - #### additional

          public <T> Dns.Builder additional(String name,
                                   Dns.RecordType rt,
                                   int ttl,
                                   T d)

      Sets the additionals array for a single resource record.
      Parameters:
        `name` - the name text
        `rt` - the resource record type
        `ttl` - the time to live in seconds
        `d` - the resource data
      Returns:
        this instance

    - #### responseFor

          public Dns.Builder responseFor(Dns query)

      A convenience method to construct a response object for the given query.
      Parameters:
        `query` - the original DNS query request
      Returns:
        this instance

Copyright © 2014. All Rights Reserved.