use of com.microsoft.azure.sdk.iot.deps.serializer.ConfigurationParser in project azure-iot-sdk-java by Azure.
the class Configuration method toConfigurationParser.
/**
* Converts this into a ConfigurationParser object. To serialize a Configuration object, it must first be converted
* to a ConfigurationParser object.
*
* @return the ConfigurationParser object that can be serialized.
*/
ConfigurationParser toConfigurationParser() {
// Codes_SRS_SERVICE_SDK_JAVA_CONFIGURATION_28_004: [This method shall return a new instance of a ConfigurationParser
// object that is populated using the properties of this.]
ConfigurationParser configurationParser = new ConfigurationParser();
configurationParser.setId(this.id);
configurationParser.setSchemaVersion(this.schemaVersion);
configurationParser.setLabels(this.labels);
configurationParser.setTargetCondition(this.targetCondition);
configurationParser.setCreatedTimeUtc(ParserUtility.getDateTimeUtc(this.createdTimeUtc));
configurationParser.setLastUpdatedTimeUtc(ParserUtility.getDateTimeUtc(this.lastUpdatedTimeUtc));
configurationParser.setPriority(this.priority);
configurationParser.setETag(this.etag);
if (this.content != null) {
ConfigurationContentParser parser = new ConfigurationContentParser();
parser.setDeviceContent(this.content.getDeviceContent());
parser.setModulesContent(this.content.getModulesContent());
parser.setModuleContent(this.content.getModuleContent());
configurationParser.setContent(parser);
}
if (this.systemMetrics != null) {
ConfigurationMetricsParser parser = new ConfigurationMetricsParser();
parser.setQueries(this.systemMetrics.getQueries());
parser.setResults(this.systemMetrics.getResults());
configurationParser.setSystemMetrics(parser);
}
if (this.metrics != null) {
ConfigurationMetricsParser parser = new ConfigurationMetricsParser();
parser.setQueries(this.metrics.getQueries());
parser.setResults(this.metrics.getResults());
configurationParser.setMetrics(parser);
}
return configurationParser;
}
Aggregations