
com.azure.resourcemanager.datafactory.models.PipelineReference 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.core.util.logging.ClientLogger;
import com.azure.json.JsonReader;
import com.azure.json.JsonSerializable;
import com.azure.json.JsonToken;
import com.azure.json.JsonWriter;
import java.io.IOException;
/**
* Pipeline reference type.
*/
@Fluent
public final class PipelineReference implements JsonSerializable {
/*
* Pipeline reference type.
*/
private final String type = "PipelineReference";
/*
* Reference pipeline name.
*/
private String referenceName;
/*
* Reference name.
*/
private String name;
/**
* Creates an instance of PipelineReference class.
*/
public PipelineReference() {
}
/**
* Get the type property: Pipeline reference type.
*
* @return the type value.
*/
public String type() {
return this.type;
}
/**
* Get the referenceName property: Reference pipeline name.
*
* @return the referenceName value.
*/
public String referenceName() {
return this.referenceName;
}
/**
* Set the referenceName property: Reference pipeline name.
*
* @param referenceName the referenceName value to set.
* @return the PipelineReference object itself.
*/
public PipelineReference withReferenceName(String referenceName) {
this.referenceName = referenceName;
return this;
}
/**
* Get the name property: Reference name.
*
* @return the name value.
*/
public String name() {
return this.name;
}
/**
* Set the name property: Reference name.
*
* @param name the name value to set.
* @return the PipelineReference object itself.
*/
public PipelineReference withName(String name) {
this.name = name;
return this;
}
/**
* Validates the instance.
*
* @throws IllegalArgumentException thrown if the instance is not valid.
*/
public void validate() {
if (referenceName() == null) {
throw LOGGER.atError()
.log(
new IllegalArgumentException("Missing required property referenceName in model PipelineReference"));
}
}
private static final ClientLogger LOGGER = new ClientLogger(PipelineReference.class);
/**
* {@inheritDoc}
*/
@Override
public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
jsonWriter.writeStartObject();
jsonWriter.writeStringField("type", this.type);
jsonWriter.writeStringField("referenceName", this.referenceName);
jsonWriter.writeStringField("name", this.name);
return jsonWriter.writeEndObject();
}
/**
* Reads an instance of PipelineReference from the JsonReader.
*
* @param jsonReader The JsonReader being read.
* @return An instance of PipelineReference if the JsonReader was pointing to an instance of it, or null if it was
* pointing to JSON null.
* @throws IllegalStateException If the deserialized JSON object was missing any required properties.
* @throws IOException If an error occurs while reading the PipelineReference.
*/
public static PipelineReference fromJson(JsonReader jsonReader) throws IOException {
return jsonReader.readObject(reader -> {
PipelineReference deserializedPipelineReference = new PipelineReference();
while (reader.nextToken() != JsonToken.END_OBJECT) {
String fieldName = reader.getFieldName();
reader.nextToken();
if ("referenceName".equals(fieldName)) {
deserializedPipelineReference.referenceName = reader.getString();
} else if ("name".equals(fieldName)) {
deserializedPipelineReference.name = reader.getString();
} else {
reader.skipChildren();
}
}
return deserializedPipelineReference;
});
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy