你当前正在访问 Microsoft Azure Global Edition 技术文档网站。 如果需要访问由世纪互联运营的 Microsoft Azure 中国技术文档网站,请访问 https://docs.azure.cn

IotHubConnectionStringBuilder Class

  • java.lang.Object
    • com.microsoft.azure.sdk.iot.service.IotHubConnectionStringBuilder

public class IotHubConnectionStringBuilder

Provide static constructors to create IotHubConnectionString object

Constructor Summary

Constructor Description
IotHubConnectionStringBuilder()

Method Summary

Modifier and Type Method and Description
static IotHubConnectionString createConnectionString(String connectionString)

Deprecated

Use createIotHubConnectionString(String connectionString) since it does not declare any thrown exceptions

Static constructor to create IotHubConnectionString from the given string

static IotHubConnectionString createConnectionString(String hostName, AuthenticationMethod authenticationMethod)

Deprecated

Static constructor to create IotHubConnectionString from host name and authentication method

static IotHubConnectionString createIotHubConnectionString(String connectionString)

Static constructor to create IotHubConnectionString from the given string

static IotHubConnectionString createIotHubConnectionString(String hostName, AuthenticationMethod authenticationMethod)

Static constructor to create IotHubConnectionString from host name and authentication method

protected static void parse(String connectionString, IotHubConnectionString iotHubConnectionString)

Deserialize connection string

protected static java.lang.String parseIotHubName(IotHubConnectionString iotHubConnectionString)

Parse the iot hub name part from the host name

protected static void setAuthenticationMethod(AuthenticationMethod authenticationMethod, IotHubConnectionString iotHubConnectionString)

Set authentication method to target IotHubConnectionString object

protected static void setHostName(String hostName, IotHubConnectionString iotHubConnectionString)

Set host name value to target IotHubConnectionString object

protected static void validate(IotHubConnectionString iotHubConnectionString)

Validate IotHubConnectionString format

protected static void validateFormat(String value, String regex)

Validate string property using given regex

protected static void validateFormatIfSpecified(String value, String regex)

Validate string property using given regex if value is not null or empty

Methods inherited from java.lang.Object

java.lang.Object.clone java.lang.Object.equals java.lang.Object.finalize java.lang.Object.getClass java.lang.Object.hashCode java.lang.Object.notify java.lang.Object.notifyAll java.lang.Object.toString java.lang.Object.wait java.lang.Object.wait java.lang.Object.wait

Constructor Details

IotHubConnectionStringBuilder

public IotHubConnectionStringBuilder()

Method Details

createConnectionString


public static IotHubConnectionString createConnectionString(String connectionString)

Deprecated

Use createIotHubConnectionString(String connectionString) since it does not declare any thrown exceptions

Static constructor to create IotHubConnectionString from the given string

Parameters:

connectionString - The connection string

Returns:

The IotHubConnectionString object

Throws:

java.io.IOException - This exception is never thrown. Users are advised to use #createIotHubConnectionString(String, AuthenticationMethod) instead since it's method signature does not declare any thrown exceptions.

createConnectionString


public static IotHubConnectionString createConnectionString(String hostName, AuthenticationMethod authenticationMethod)

Deprecated

Static constructor to create IotHubConnectionString from host name and authentication method

Parameters:

hostName - The hostName string
authenticationMethod - The AuthenticationMethod object

Returns:

The IotHubConnectionString object

Throws:

java.io.IOException - This exception is never thrown. Users are advised to use #createIotHubConnectionString(String, AuthenticationMethod) instead since it's method signature does not declare any thrown exceptions.

createIotHubConnectionString

public static IotHubConnectionString createIotHubConnectionString(String connectionString)

Static constructor to create IotHubConnectionString from the given string

Parameters:

connectionString - The connection string

Returns:

The IotHubConnectionString object

createIotHubConnectionString

public static IotHubConnectionString createIotHubConnectionString(String hostName, AuthenticationMethod authenticationMethod)

Static constructor to create IotHubConnectionString from host name and authentication method

Parameters:

hostName - The hostName string
authenticationMethod - The AuthenticationMethod object

Returns:

The IotHubConnectionString object

parse

protected static void parse(String connectionString, IotHubConnectionString iotHubConnectionString)

Deserialize connection string

Parameters:

connectionString - The connection string to deserialize
iotHubConnectionString - The target object for deserialization

parseIotHubName

protected static String parseIotHubName(IotHubConnectionString iotHubConnectionString)

Parse the iot hub name part from the host name

Parameters:

iotHubConnectionString - The source iotHubConnectionString containing the hostName

Returns:

The substring of the host name until the first "." character

setAuthenticationMethod

protected static void setAuthenticationMethod(AuthenticationMethod authenticationMethod, IotHubConnectionString iotHubConnectionString)

Set authentication method to target IotHubConnectionString object

Parameters:

authenticationMethod - value to set
iotHubConnectionString - target IotHubConnectionString object

setHostName

protected static void setHostName(String hostName, IotHubConnectionString iotHubConnectionString)

Set host name value to target IotHubConnectionString object

Parameters:

hostName - host name string
iotHubConnectionString - target IotHubConnectionString object

validate

protected static void validate(IotHubConnectionString iotHubConnectionString)

Validate IotHubConnectionString format

Parameters:

iotHubConnectionString - The object to validate

Throws:

java.lang.IllegalArgumentException - This exception is thrown if the input object is null

validateFormat

protected static void validateFormat(String value, String regex)

Validate string property using given regex

Parameters:

value - The string value to validate
regex - The regex used for validation

validateFormatIfSpecified

protected static void validateFormatIfSpecified(String value, String regex)

Validate string property using given regex if value is not null or empty

Parameters:

value - string value to validate
regex - regex used for validation

Applies to