public class QueryResult extends Object
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 of Strings
and you shall parse it by your own.
The system properties are:
QueryResultType
for the possible types and classes
to cast.
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"
}
]
Modifier | Constructor and Description |
---|---|
protected |
QueryResult()
Empty constructor
|
|
QueryResult(String type,
String body,
String continuationToken)
CONSTRUCTOR
|
Modifier and Type | Method and Description |
---|---|
String |
toString()
Creates a pretty print JSON with the content of this class and subclasses.
|
public QueryResult(String type, String body, String continuationToken)
This constructor creates an instance of the QueryResult.
type
- the String
with type of the content in the body. It cannot be null
body
- the String
with the body in a JSON list format. It cannot be null
, or empty, if the type is different than `unknown`.continuationToken
- the String
with the continuation token. It can be null
.IllegalArgumentException
- If one of the provided parameters is invalid.protected QueryResult()
Used only by the tools that will deserialize this class.
public String toString()
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.
Copyright © 2022. All rights reserved.