Package org.xbill.DNS

Class Generator

java.lang.Object
org.xbill.DNS.Generator

public class Generator extends Object
A representation of a $GENERATE statement in a master file.
Author:
Brian Wellington
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    final int
    The class of the generated records.
    long
    The end of the range.
    final String
    The pattern to use for generating record names.
    final Name
    The origin to append to relative names.
    final String
    The pattern to use for generating record data.
    long
    The start of the range.
    long
    The step value of the range.
    final long
    The ttl of the generated records.
    final int
    The type of the generated records.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Generator(long start, long end, long step, String namePattern, int type, int dclass, long ttl, String rdataPattern, Name origin)
    Creates a specification for generating records, as a $GENERATE statement in a master file.
  • Method Summary

    Modifier and Type
    Method
    Description
    Constructs and returns all records in the expansion.
    Constructs and returns the next record in the expansion.
    static boolean
    supportedType(int type)
    Indicates whether generation is supported for this type.
    Converts the generate specification to a string containing the corresponding $GENERATE statement.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Field Details

    • start

      public long start
      The start of the range.
    • end

      public long end
      The end of the range.
    • step

      public long step
      The step value of the range.
    • namePattern

      public final String namePattern
      The pattern to use for generating record names.
    • type

      public final int type
      The type of the generated records.
    • dclass

      public final int dclass
      The class of the generated records.
    • ttl

      public final long ttl
      The ttl of the generated records.
    • rdataPattern

      public final String rdataPattern
      The pattern to use for generating record data.
    • origin

      public final Name origin
      The origin to append to relative names.
  • Constructor Details

    • Generator

      public Generator(long start, long end, long step, String namePattern, int type, int dclass, long ttl, String rdataPattern, Name origin)
      Creates a specification for generating records, as a $GENERATE statement in a master file.
      Parameters:
      start - The start of the range.
      end - The end of the range.
      step - The step value of the range.
      namePattern - The pattern to use for generating record names.
      type - The type of the generated records. The supported types are PTR, CNAME, DNAME, A, AAAA, and NS.
      dclass - The class of the generated records.
      ttl - The ttl of the generated records.
      rdataPattern - The pattern to use for generating record data.
      origin - The origin to append to relative names.
      Throws:
      IllegalArgumentException - The range is invalid.
      IllegalArgumentException - The type does not support generation.
      IllegalArgumentException - The dclass is not a valid class.
  • Method Details

    • supportedType

      public static boolean supportedType(int type)
      Indicates whether generation is supported for this type.
      Throws:
      InvalidTypeException - The type is out of range.
    • nextRecord

      public Record nextRecord() throws IOException
      Constructs and returns the next record in the expansion.
      Throws:
      IOException - The name or rdata was invalid after substitutions were performed.
    • expand

      public Record[] expand() throws IOException
      Constructs and returns all records in the expansion.
      Throws:
      IOException - The name or rdata of a record was invalid after substitutions were performed.
    • toString

      public String toString()
      Converts the generate specification to a string containing the corresponding $GENERATE statement.
      Overrides:
      toString in class Object