QueryResult Class

  • java.lang.Object
    • com.microsoft.azure.sdk.iot.provisioning.service.configs.QueryResult

public class QueryResult

Representation of a single Device Provisioning Service query response with a JSON deserializer.

It is the result of any query for the provisioning service. This class will parse the result and return it in a best format possible. For the known formats in QueryResultType, you can just cast the items. In case of unknown type, the items will contain a list ofStrings 

</code> and you shall parse it by your own.</p>

The system properties are:

And the body is a JSON list of the specific type. For instance, if the system property type is IndividualEnrollment, the body will look like:

[
    {

        "registrationId":"validRegistrationId-1",

        "deviceId":"ContosoDevice-1",

        "attestation":{

            "type":"tpm",

            "tpm":{

                "endorsementKey":"validEndorsementKey"

            }

        },

        "iotHubHostName":"ContosoIoTHub.azure-devices.net",

        "provisioningStatus":"enabled"

    },

    {

        "registrationId":"validRegistrationId-2",

        "deviceId":"ContosoDevice-2",

        "attestation":{

            "type":"tpm",

           "tpm":{

                "endorsementKey":"validEndorsementKey"

            }

        },

        "iotHubHostName":"ContosoIoTHub.azure-devices.net",

        "provisioningStatus":"enabled"

    }

]

</code></pre></p>

Constructor Summary

Constructor Description
QueryResult()

Empty constructor

Used only by the tools that will deserialize this class.

QueryResult(String type, String body, String continuationToken)

CONSTRUCTOR

This constructor creates an instance of the QueryResult.

Method Summary

Modifier and Type Method and Description
String toString()

Creates a pretty print JSON with the content of this class and subclasses.

The result of this function is not a valid JSON for the provisioning service, it is just to provide a way to print its content.

Constructor Details

QueryResult

protected QueryResult()

Empty constructor

Used only by the tools that will deserialize this class.

QueryResult

public QueryResult(String type, String body, String continuationToken)

CONSTRUCTOR

This constructor creates an instance of the QueryResult.

Parameters:

type -

theString 

</code> with type of the content in the body. It cannot be<code>null 

</code></p>
body -

theString 

</code> with the body in a JSON list format. It cannot be<code>null 

</code> , or empty, if the type is different than `unknown`. </p>
continuationToken -

theString 

</code> with the continuation token. It can be<code>null 

</code> . </p>

Throws:

IllegalArgumentException - If one of the provided parameters is invalid.

Method Details

toString

public String toString()

Creates a pretty print JSON with the content of this class and subclasses.

The result of this function is not a valid JSON for the provisioning service, it is just to provide a way to print its content.

Returns:

TheString 

</code> with the pretty print JSON. </p>

Applies to