DnsSdServiceInfo.Builder

public static final class DnsSdServiceInfo.Builder extends Object

Builder class to generate DnsSdServiceInfo instances.

Public Constructor Summary

Public Method Summary

DnsSdServiceInfo.Builder
addAllNetworkLocations(List<NetworkLocation> networkLocations)
Adds the given list of NetworkLocations.
DnsSdServiceInfo.Builder
addAllTxtRecords(Collection<TxtRecord> txtRecords)
Adds the given txtRecords.
DnsSdServiceInfo.Builder
addNetworkLocation(NetworkLocation networkLocation)
Adds the given NetworkLocation.
DnsSdServiceInfo.Builder
addTxtRecord(TxtRecord txtRecord)
Adds the given txtRecord.
DnsSdServiceInfo
build()
Builds a new instance of DnsSdServiceInfo as configured in this builder.
DnsSdServiceInfo.Builder
setInstanceName(String instanceName)
Set the DNS-SD instance name of the service.
DnsSdServiceInfo.Builder
setServiceType(String serviceType)
Set the DNS-SD service type.

Inherited Method Summary

Public Constructors

public Builder ()

Public Methods

public DnsSdServiceInfo.Builder addAllNetworkLocations (List<NetworkLocation> networkLocations)

Adds the given list of NetworkLocations.

Returns
  • this builder

public DnsSdServiceInfo.Builder addAllTxtRecords (Collection<TxtRecord> txtRecords)

Adds the given txtRecords.

Returns
  • this builder
Throws
IllegalArgumentException if a TxtRecord with the same key has already been added, or txtRecords contains any duplicate keys

public DnsSdServiceInfo.Builder addNetworkLocation (NetworkLocation networkLocation)

Adds the given NetworkLocation.

Returns
  • this builder

public DnsSdServiceInfo.Builder addTxtRecord (TxtRecord txtRecord)

Adds the given txtRecord.

Returns
  • this builder
Throws
IllegalArgumentException if a TxtRecord with the same key has already been added

public DnsSdServiceInfo build ()

Builds a new instance of DnsSdServiceInfo as configured in this builder.

Throws
IllegalStateException if the instance name or service type are missing or empty, or the list of network locations is empty

public DnsSdServiceInfo.Builder setInstanceName (String instanceName)

Set the DNS-SD instance name of the service.

Returns
  • this builder
Throws
IllegalArgumentException if instanceName is empty

public DnsSdServiceInfo.Builder setServiceType (String serviceType)

Set the DNS-SD service type.

Returns
  • this builder
Throws
IllegalArgumentException if serviceType is empty