Class DNSRecordSRV

java.lang.Object
com.microsoft.sqlserver.jdbc.dns.DNSRecordSRV
All Implemented Interfaces:
java.lang.Comparable<DNSRecordSRV>

public class DNSRecordSRV
extends java.lang.Object
implements java.lang.Comparable<DNSRecordSRV>
Represents a DNS SRV Record.
  • Constructor Summary

    Constructors
    Constructor Description
    DNSRecordSRV​(int priority, int weight, int port, java.lang.String serverName)
    Constructs a DNSRecordSRV.
  • Method Summary

    Modifier and Type Method Description
    int compareTo​(DNSRecordSRV o)  
    boolean equals​(java.lang.Object other)  
    int getPort()
    Returns the IP port of record.
    int getPriority()
    Returns the priority of DNS SRV record.
    java.lang.String getServerName()
    Returns the DNS server name.
    int getWeight()
    Returns the weight of DNS record from 0 to 65535.
    int hashCode()  
    static DNSRecordSRV parseFromDNSRecord​(java.lang.String record)
    Parses a DNS SRC Record from a DNS String record.
    java.lang.String toString()  

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • DNSRecordSRV

      public DNSRecordSRV​(int priority, int weight, int port, java.lang.String serverName) throws java.lang.IllegalArgumentException
      Constructs a DNSRecordSRV.
      Parameters:
      priority - is lowest
      weight - 1 at minimum
      port - the port of service
      serverName - the host
      Throws:
      java.lang.IllegalArgumentException - if priority < 0 or weight <= 1
  • Method Details

    • parseFromDNSRecord

      public static DNSRecordSRV parseFromDNSRecord​(java.lang.String record) throws java.lang.IllegalArgumentException
      Parses a DNS SRC Record from a DNS String record.
      Parameters:
      record - the record to parse
      Returns:
      a not null DNS Record
      Throws:
      java.lang.IllegalArgumentException - if record is not correct and cannot be parsed
    • toString

      public java.lang.String toString()
      Overrides:
      toString in class java.lang.Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class java.lang.Object
    • equals

      public boolean equals​(java.lang.Object other)
      Overrides:
      equals in class java.lang.Object
    • compareTo

      public int compareTo​(DNSRecordSRV o)
      Specified by:
      compareTo in interface java.lang.Comparable<DNSRecordSRV>
    • getPriority

      public int getPriority()
      Returns the priority of DNS SRV record.
      Returns:
      a positive priority, where lowest values have to be considered first.
    • getWeight

      public int getWeight()
      Returns the weight of DNS record from 0 to 65535.
      Returns:
      The weight, higher value means higher probability of selecting the given record for a given priority.
    • getPort

      public int getPort()
      Returns the IP port of record.
      Returns:
      a value from 1 to 65535.
    • getServerName

      public java.lang.String getServerName()
      Returns the DNS server name.
      Returns:
      a not null server name.