Skip to content

Commit

Permalink
Add builders
Browse files Browse the repository at this point in the history
  • Loading branch information
jianghaolu committed Jun 6, 2019
1 parent 83fa983 commit b55810d
Show file tree
Hide file tree
Showing 4 changed files with 251 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
// Code generated by Microsoft (R) AutoRest Code Generator.

package com.azure.storage.blob.implementation;

import com.azure.core.http.HttpPipeline;
import com.azure.core.implementation.RestProxy;

/**
* A builder for creating a new instance of the AzureBlobStorage type.
*/
public final class AzureBlobStorageBuilder {
/*
* The URL of the service account, container, or blob that is the targe of the desired operation.
*/
private String url;

/**
* Sets The URL of the service account, container, or blob that is the targe of the desired operation.
*
* @param url the url value.
* @return the AzureBlobStorageBuilder.
*/
public AzureBlobStorageBuilder url(String url) {
this.url = url;
return this;
}

/*
* Specifies the version of the operation to use for this request.
*/
private String version;

/**
* Sets Specifies the version of the operation to use for this request.
*
* @param version the version value.
* @return the AzureBlobStorageBuilder.
*/
public AzureBlobStorageBuilder version(String version) {
this.version = version;
return this;
}

/*
* The HTTP pipeline to send requests through
*/
private HttpPipeline pipeline;

/**
* Sets The HTTP pipeline to send requests through.
*
* @param pipeline the pipeline value.
* @return the AzureBlobStorageBuilder.
*/
public AzureBlobStorageBuilder pipeline(HttpPipeline pipeline) {
this.pipeline = pipeline;
return this;
}

/**
* Builds an instance of AzureBlobStorageImpl with the provided parameters.
*
* @return an instance of AzureBlobStorageImpl.
*/
public AzureBlobStorageImpl build() {
if (version == null) {
this.version = "2018-11-09";
}
if (pipeline == null) {
this.pipeline = RestProxy.createDefaultPipeline();
}
AzureBlobStorageImpl client = new AzureBlobStorageImpl(pipeline);
if (this.url != null) {
client.url(this.url);
}
if (this.version != null) {
client.version(this.version);
}
return client;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
// Code generated by Microsoft (R) AutoRest Code Generator.

package com.azure.storage.file.implementation;

import com.azure.core.http.HttpPipeline;
import com.azure.core.implementation.RestProxy;

/**
* A builder for creating a new instance of the AzureFileStorage type.
*/
public final class AzureFileStorageBuilder {
/*
* Specifies the version of the operation to use for this request.
*/
private String version;

/**
* Sets Specifies the version of the operation to use for this request.
*
* @param version the version value.
* @return the AzureFileStorageBuilder.
*/
public AzureFileStorageBuilder version(String version) {
this.version = version;
return this;
}

/*
* The URL of the service account, share, directory or file that is the target of the desired operation.
*/
private String url;

/**
* Sets The URL of the service account, share, directory or file that is the target of the desired operation.
*
* @param url the url value.
* @return the AzureFileStorageBuilder.
*/
public AzureFileStorageBuilder url(String url) {
this.url = url;
return this;
}

/*
* The HTTP pipeline to send requests through
*/
private HttpPipeline pipeline;

/**
* Sets The HTTP pipeline to send requests through.
*
* @param pipeline the pipeline value.
* @return the AzureFileStorageBuilder.
*/
public AzureFileStorageBuilder pipeline(HttpPipeline pipeline) {
this.pipeline = pipeline;
return this;
}

/**
* Builds an instance of AzureFileStorageImpl with the provided parameters.
*
* @return an instance of AzureFileStorageImpl.
*/
public AzureFileStorageImpl build() {
if (version == null) {
this.version = "2018-11-09";
}
if (pipeline == null) {
this.pipeline = RestProxy.createDefaultPipeline();
}
AzureFileStorageImpl client = new AzureFileStorageImpl(pipeline);
if (this.version != null) {
client.version(this.version);
}
if (this.url != null) {
client.url(this.url);
}
return client;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import com.azure.core.ServiceClient;
import com.azure.core.http.HttpPipeline;
import com.azure.storage.queue.implementation.AzureQueueStorageBuilder;
import com.azure.storage.queue.implementation.AzureQueueStorageImpl;

import java.net.URL;
Expand All @@ -14,7 +15,7 @@ public class QueueAsyncClient extends ServiceClient {
private QueueAsyncClient(URL endpoint, HttpPipeline httpPipeline) {
super(httpPipeline);
this.endpoint = endpoint.toString();
this.generateClient = new AzureQueueStorageImpl(httpPipeline).withUrl(this.endpoint);
this.generateClient = new AzureQueueStorageBuilder().pipeline(httpPipeline).url(this.endpoint).build();
this.apiVersion = this.generateClient.version();
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
// Code generated by Microsoft (R) AutoRest Code Generator.

package com.azure.storage.queue.implementation;

import com.azure.core.http.HttpPipeline;
import com.azure.core.implementation.RestProxy;

/**
* A builder for creating a new instance of the AzureQueueStorage type.
*/
public final class AzureQueueStorageBuilder {
/*
* The URL of the service account, queue or message that is the targe of the desired operation.
*/
private String url;

/**
* Sets The URL of the service account, queue or message that is the targe of the desired operation.
*
* @param url the url value.
* @return the AzureQueueStorageBuilder.
*/
public AzureQueueStorageBuilder url(String url) {
this.url = url;
return this;
}

/*
* Specifies the version of the operation to use for this request.
*/
private String version;

/**
* Sets Specifies the version of the operation to use for this request.
*
* @param version the version value.
* @return the AzureQueueStorageBuilder.
*/
public AzureQueueStorageBuilder version(String version) {
this.version = version;
return this;
}

/*
* The HTTP pipeline to send requests through
*/
private HttpPipeline pipeline;

/**
* Sets The HTTP pipeline to send requests through.
*
* @param pipeline the pipeline value.
* @return the AzureQueueStorageBuilder.
*/
public AzureQueueStorageBuilder pipeline(HttpPipeline pipeline) {
this.pipeline = pipeline;
return this;
}

/**
* Builds an instance of AzureQueueStorageImpl with the provided parameters.
*
* @return an instance of AzureQueueStorageImpl.
*/
public AzureQueueStorageImpl build() {
if (version == null) {
this.version = "2018-03-28";
}
if (pipeline == null) {
this.pipeline = RestProxy.createDefaultPipeline();
}
AzureQueueStorageImpl client = new AzureQueueStorageImpl(pipeline);
if (this.url != null) {
client.url(this.url);
}
if (this.version != null) {
client.version(this.version);
}
return client;
}
}

0 comments on commit b55810d

Please sign in to comment.