
com.azure.resourcemanager.datafactory.models.SsisObjectMetadata Maven / Gradle / Ivy
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
// Code generated by Microsoft (R) AutoRest Code Generator.
package com.azure.resourcemanager.datafactory.models;
import com.azure.core.annotation.Fluent;
import com.azure.json.JsonReader;
import com.azure.json.JsonSerializable;
import com.azure.json.JsonToken;
import com.azure.json.JsonWriter;
import java.io.IOException;
/**
* SSIS object metadata.
*/
@Fluent
public class SsisObjectMetadata implements JsonSerializable {
/*
* Type of metadata.
*/
private SsisObjectMetadataType type = SsisObjectMetadataType.fromString("SsisObjectMetadata");
/*
* Metadata id.
*/
private Long id;
/*
* Metadata name.
*/
private String name;
/*
* Metadata description.
*/
private String description;
/**
* Creates an instance of SsisObjectMetadata class.
*/
public SsisObjectMetadata() {
}
/**
* Get the type property: Type of metadata.
*
* @return the type value.
*/
public SsisObjectMetadataType type() {
return this.type;
}
/**
* Get the id property: Metadata id.
*
* @return the id value.
*/
public Long id() {
return this.id;
}
/**
* Set the id property: Metadata id.
*
* @param id the id value to set.
* @return the SsisObjectMetadata object itself.
*/
public SsisObjectMetadata withId(Long id) {
this.id = id;
return this;
}
/**
* Get the name property: Metadata name.
*
* @return the name value.
*/
public String name() {
return this.name;
}
/**
* Set the name property: Metadata name.
*
* @param name the name value to set.
* @return the SsisObjectMetadata object itself.
*/
public SsisObjectMetadata withName(String name) {
this.name = name;
return this;
}
/**
* Get the description property: Metadata description.
*
* @return the description value.
*/
public String description() {
return this.description;
}
/**
* Set the description property: Metadata description.
*
* @param description the description value to set.
* @return the SsisObjectMetadata object itself.
*/
public SsisObjectMetadata withDescription(String description) {
this.description = description;
return this;
}
/**
* Validates the instance.
*
* @throws IllegalArgumentException thrown if the instance is not valid.
*/
public void validate() {
}
/**
* {@inheritDoc}
*/
@Override
public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
jsonWriter.writeStartObject();
jsonWriter.writeStringField("type", this.type == null ? null : this.type.toString());
jsonWriter.writeNumberField("id", this.id);
jsonWriter.writeStringField("name", this.name);
jsonWriter.writeStringField("description", this.description);
return jsonWriter.writeEndObject();
}
/**
* Reads an instance of SsisObjectMetadata from the JsonReader.
*
* @param jsonReader The JsonReader being read.
* @return An instance of SsisObjectMetadata if the JsonReader was pointing to an instance of it, or null if it was
* pointing to JSON null.
* @throws IOException If an error occurs while reading the SsisObjectMetadata.
*/
public static SsisObjectMetadata fromJson(JsonReader jsonReader) throws IOException {
return jsonReader.readObject(reader -> {
String discriminatorValue = null;
try (JsonReader readerToUse = reader.bufferObject()) {
readerToUse.nextToken(); // Prepare for reading
while (readerToUse.nextToken() != JsonToken.END_OBJECT) {
String fieldName = readerToUse.getFieldName();
readerToUse.nextToken();
if ("type".equals(fieldName)) {
discriminatorValue = readerToUse.getString();
break;
} else {
readerToUse.skipChildren();
}
}
// Use the discriminator value to determine which subtype should be deserialized.
if ("Folder".equals(discriminatorValue)) {
return SsisFolder.fromJson(readerToUse.reset());
} else if ("Project".equals(discriminatorValue)) {
return SsisProject.fromJson(readerToUse.reset());
} else if ("Package".equals(discriminatorValue)) {
return SsisPackage.fromJson(readerToUse.reset());
} else if ("Environment".equals(discriminatorValue)) {
return SsisEnvironment.fromJson(readerToUse.reset());
} else {
return fromJsonKnownDiscriminator(readerToUse.reset());
}
}
});
}
static SsisObjectMetadata fromJsonKnownDiscriminator(JsonReader jsonReader) throws IOException {
return jsonReader.readObject(reader -> {
SsisObjectMetadata deserializedSsisObjectMetadata = new SsisObjectMetadata();
while (reader.nextToken() != JsonToken.END_OBJECT) {
String fieldName = reader.getFieldName();
reader.nextToken();
if ("type".equals(fieldName)) {
deserializedSsisObjectMetadata.type = SsisObjectMetadataType.fromString(reader.getString());
} else if ("id".equals(fieldName)) {
deserializedSsisObjectMetadata.id = reader.getNullable(JsonReader::getLong);
} else if ("name".equals(fieldName)) {
deserializedSsisObjectMetadata.name = reader.getString();
} else if ("description".equals(fieldName)) {
deserializedSsisObjectMetadata.description = reader.getString();
} else {
reader.skipChildren();
}
}
return deserializedSsisObjectMetadata;
});
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy