text:
package com.microsoft.azure.management.containerregistry.v2018_09_01.implementation;

import retrofit2.Retrofit;
import com.google.common.reflect.TypeToken;
import com.microsoft.azure.AzureServiceFuture;
import com.microsoft.azure.CloudException;
import com.microsoft.azure.ListOperationCallback;
import com.microsoft.azure.management.containerregistry.v2018_09_01.WebhookCreateParameters;
import com.microsoft.azure.management.containerregistry.v2018_09_01.WebhookUpdateParameters;
import com.microsoft.azure.Page;
import com.microsoft.azure.PagedList;
import com.microsoft.rest.ServiceCallback;
import com.microsoft.rest.ServiceFuture;
import com.microsoft.rest.ServiceResponse;
import com.microsoft.rest.Validator;
import java.io.IOException;
import java.util.List;
import okhttp3.ResponseBody;
import retrofit2.http.Body;
import retrofit2.http.GET;
import retrofit2.http.Header;
import retrofit2.http.Headers;
import retrofit2.http.HTTP;
import retrofit2.http.PATCH;
import retrofit2.http.Path;
import retrofit2.http.POST;
import retrofit2.http.PUT;
import retrofit2.http.Query;
import retrofit2.http.Url;
import retrofit2.Response;
import rx.functions.Func1;
import rx.Observable;

/**
 * An instance of this class provides access to all the operations defined
 * in Webhooks.
 */
public class WebhooksInner {
    /** The Retrofit service to perform REST calls. */
    private WebhooksService service;
    /** The service client containing this operation class. */
    private ContainerRegistryManagementClientImpl client;

    /**
     * Initializes an instance of WebhooksInner.
     *
     * @param retrofit the Retrofit instance built from a Retrofit Builder.
     * @param client the instance of the service client containing this operation class.
     */
    public WebhooksInner(Retrofit retrofit, ContainerRegistryManagementClientImpl client) {
        this.service = retrofit.create(WebhooksService.class);
        this.client = client;
    }

    /**
     * The interface defining all the services for Webhooks to be
     * used by Retrofit to perform actually REST calls.
     */
    interface WebhooksService {
        @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.containerregistry.v2018_09_01.Webhooks get" })
        @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/webhooks/{webhookName}")
        Observable<Response<ResponseBody>> get(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("registryName") String registryName, @Path("webhookName") String webhookName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent);

        @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.containerregistry.v2018_09_01.Webhooks create" })
        @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/webhooks/{webhookName}")
        Observable<Response<ResponseBody>> create(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("registryName") String registryName, @Path("webhookName") String webhookName, @Query("api-version") String apiVersion, @Body WebhookCreateParameters webhookCreateParameters, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent);

        @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.containerregistry.v2018_09_01.Webhooks beginCreate" })
        @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/webhooks/{webhookName}")
        Observable<Response<ResponseBody>> beginCreate(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("registryName") String registryName, @Path("webhookName") String webhookName, @Query("api-version") String apiVersion, @Body WebhookCreateParameters webhookCreateParameters, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent);

        @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.containerregistry.v2018_09_01.Webhooks delete" })
        @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/webhooks/{webhookName}", method = "DELETE", hasBody = true)
        Observable<Response<ResponseBody>> delete(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("registryName") String registryName, @Path("webhookName") String webhookName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent);

        @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.containerregistry.v2018_09_01.Webhooks beginDelete" })
        @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/webhooks/{webhookName}", method = "DELETE", hasBody = true)
        Observable<Response<ResponseBody>> beginDelete(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("registryName") String registryName, @Path("webhookName") String webhookName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent);

        @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.containerregistry.v2018_09_01.Webhooks update" })
        @PATCH("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/webhooks/{webhookName}")
        Observable<Response<ResponseBody>> update(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("registryName") String registryName, @Path("webhookName") String webhookName, @Query("api-version") String apiVersion, @Body WebhookUpdateParameters webhookUpdateParameters, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent);

        @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.containerregistry.v2018_09_01.Webhooks beginUpdate" })
        @PATCH("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/webhooks/{webhookName}")
        Observable<Response<ResponseBody>> beginUpdate(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("registryName") String registryName, @Path("webhookName") String webhookName, @Query("api-version") String apiVersion, @Body WebhookUpdateParameters webhookUpdateParameters, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent);

        @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.containerregistry.v2018_09_01.Webhooks list" })
        @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/webhooks")
        Observable<Response<ResponseBody>> list(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("registryName") String registryName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent);

        @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.containerregistry.v2018_09_01.Webhooks ping" })
        @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/webhooks/{webhookName}/ping")
        Observable<Response<ResponseBody>> ping(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("registryName") String registryName, @Path("webhookName") String webhookName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent);

        @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.containerregistry.v2018_09_01.Webhooks getCallbackConfig" })
        @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/webhooks/{webhookName}/getCallbackConfig")
        Observable<Response<ResponseBody>> getCallbackConfig(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("registryName") String registryName, @Path("webhookName") String webhookName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent);

        @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.containerregistry.v2018_09_01.Webhooks listEvents" })
        @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/webhooks/{webhookName}/listEvents")
        Observable<Response<ResponseBody>> listEvents(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("registryName") String registryName, @Path("webhookName") String webhookName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent);

        @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.containerregistry.v2018_09_01.Webhooks listNext" })
        @GET
        Observable<Response<ResponseBody>> listNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent);

        @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.containerregistry.v2018_09_01.Webhooks listEventsNext" })
        @GET
        Observable<Response<ResponseBody>> listEventsNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent);

    }

    /**
     * Gets the properties of the specified webhook.
     *
     * @param resourceGroupName The name of the resource group to which the container registry belongs.
     * @param registryName The name of the container registry.
     * @param webhookName The name of the webhook.
     * @throws IllegalArgumentException thrown if parameters fail the validation
     * @throws CloudException thrown if the request is rejected by server
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
     * @return the WebhookInner object if successful.
     */
    public WebhookInner get(String resourceGroupName, String registryName, String webhookName) {
        return getWithServiceResponseAsync(resourceGroupName, registryName, webhookName).toBlocking().single().body();
    }

    /**
     * Gets the properties of the specified webhook.
     *
     * @param resourceGroupName The name of the resource group to which the container registry belongs.
     * @param registryName The name of the container registry.
     * @param webhookName The name of the webhook.
     * @param serviceCallback the async ServiceCallback to handle successful and failed responses.
     * @throws IllegalArgumentException thrown if parameters fail the validation
     * @return the {@link ServiceFuture} object
     */
    public ServiceFuture<WebhookInner> getAsync(String resourceGroupName, String registryName, String webhookName, final ServiceCallback<WebhookInner> serviceCallback) {
        return ServiceFuture.fromResponse(getWithServiceResponseAsync(resourceGroupName, registryName, webhookName), serviceCallback);
    }

    /**
     * Gets the properties of the specified webhook.
     *
     * @param resourceGroupName The name of the resource group to which the container registry belongs.
     * @param registryName The name of the container registry.
     * @param webhookName The name of the webhook.
     * @throws IllegalArgumentException thrown if parameters fail the validation
     * @return the observable to the WebhookInner object
     */
    public Observable<WebhookInner> getAsync(String resourceGroupName, String registryName, String webhookName) {
        return getWithServiceResponseAsync(resourceGroupName, registryName, webhookName).map(new Func1<ServiceResponse<WebhookInner>, WebhookInner>() {
            @Override
            public WebhookInner call(ServiceResponse<WebhookInner> response) {
                return response.body();
            }
        });
    }

    /**
     * Gets the properties of the specified webhook.
     *
     * @param resourceGroupName The name of the resource group to which the container registry belongs.
     * @param registryName The name of the container registry.
     * @param webhookName The name of the webhook.
     * @throws IllegalArgumentException thrown if parameters fail the validation
     * @return the observable to the WebhookInner object
     */
    public Observable<ServiceResponse<WebhookInner>> getWithServiceResponseAsync(String resourceGroupName, String registryName, String webhookName) {
        if (this.client.subscriptionId() == null) {
            throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null.");
        }
        if (resourceGroupName == null) {
            throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.");
        }
        if (registryName == null) {
            throw new IllegalArgumentException("Parameter registryName is required and cannot be null.");
        }
        if (webhookName == null) {
            throw new IllegalArgumentException("Parameter webhookName is required and cannot be null.");
        }
        final String apiVersion = "2017-10-01";
        return service.get(this.client.subscriptionId(), resourceGroupName, registryName, webhookName, apiVersion, this.client.acceptLanguage(), this.client.userAgent())
            .flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<WebhookInner>>>() {
                @Override
                public Observable<ServiceResponse<WebhookInner>> call(Response<ResponseBody> response) {
                    try {
                        ServiceResponse<WebhookInner> clientResponse = getDelegate(response);
                        return Observable.just(clientResponse);
                    } catch (Throwable t) {
                        return Observable.error(t);
                    }
                }
            });
    }

    private ServiceResponse<WebhookInner> getDelegate(Response<ResponseBody> response) throws CloudException, IOException, IllegalArgumentException {
        return this.client.restClient().responseBuilderFactory().<WebhookInner, CloudException>newInstance(this.client.serializerAdapter())
                .register(200, new TypeToken<WebhookInner>() { }.getType())
                .registerError(CloudException.class)
                .build(response);
    }

    /**
     * Creates a webhook for a container registry with the specified parameters.
     *
     * @param resourceGroupName The name of the resource group to which the container registry belongs.
     * @param registryName The name of the container registry.
     * @param webhookName The name of the webhook.
     * @param webhookCreateParameters The parameters for creating a webhook.
     * @throws IllegalArgumentException thrown if parameters fail the validation
     * @throws CloudException thrown if the request is rejected by server
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
     * @return the WebhookInner object if successful.
     */
    public WebhookInner create(String resourceGroupName, String registryName, String webhookName, WebhookCreateParameters webhookCreateParameters) {
        return createWithServiceResponseAsync(resourceGroupName, registryName, webhookName, webhookCreateParameters).toBlocking().last().body();
    }

    /**
     * Creates a webhook for a container registry with the specified parameters.
     *
     * @param resourceGroupName The name of the resource group to which the container registry belongs.
     * @param registryName The name of the container registry.
     * @param webhookName The name of the webhook.
     * @param webhookCreateParameters The parameters for creating a webhook.
     * @param serviceCallback the async ServiceCallback to handle successful and failed responses.
     * @throws IllegalArgumentException thrown if parameters fail the validation
     * @return the {@link ServiceFuture} object
     */
    public ServiceFuture<WebhookInner> createAsync(String resourceGroupName, String registryName, String webhookName, WebhookCreateParameters webhookCreateParameters, final ServiceCallback<WebhookInner> serviceCallback) {
        return ServiceFuture.fromResponse(createWithServiceResponseAsync(resourceGroupName, registryName, webhookName, webhookCreateParameters), serviceCallback);
    }

    /**
     * Creates a webhook for a container registry with the specified parameters.
     *
     * @param resourceGroupName The name of the resource group to which the container registry belongs.
     * @param registryName The name of the container registry.
     * @param webhookName The name of the webhook.
     * @param webhookCreateParameters The parameters for creating a webhook.
     * @throws IllegalArgumentException thrown if parameters fail the validation
     * @return the observable for the request
     */
    public Observable<WebhookInner> createAsync(String resourceGroupName, String registryName, String webhookName, WebhookCreateParameters webhookCreateParameters) {
        return createWithServiceResponseAsync(resourceGroupName, registryName, webhookName, webhookCreateParameters).map(new Func1<ServiceResponse<WebhookInner>, WebhookInner>() {
            @Override
            public WebhookInner call(ServiceResponse<WebhookInner> response) {
                return response.body();
            }
        });
    }

    /**
     * Creates a webhook for a container registry with the specified parameters.
     *
     * @param resourceGroupName The name of the resource group to which the container registry belongs.
     * @param registryName The name of the container registry.
     * @param webhookName The name of the webhook.
     * @param webhookCreateParameters The parameters for creating a webhook.
     * @throws IllegalArgumentException thrown if parameters fail the validation
     * @return the observable for the request
     */
    public Observable<ServiceResponse<WebhookInner>> createWithServiceResponseAsync(String resourceGroupName, String registryName, String webhookName, WebhookCreateParameters webhookCreateParameters) {
        if (this.client.subscriptionId() == null) {
            throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null.");
        }
        if (resourceGroupName == null) {
            throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.");
        }
        if (registryName == null) {
            throw new IllegalArgumentException("Parameter registryName is required and cannot be null.");
        }
        if (webhookName == null) {
            throw new IllegalArgumentException("Parameter webhookName is required and cannot be null.");
        }
        if (webhookCreateParameters == null) {
            throw new IllegalArgumentException("Parameter webhookCreateParameters is required and cannot be null.");
        }
        Validator.validate(webhookCreateParameters);
        final String apiVersion = "2017-10-01";
        Observable<Response<ResponseBody>> observable = service.create(this.client.subscriptionId(), resourceGroupName, registryName, webhookName, apiVersion, webhookCreateParameters, this.client.acceptLanguage(), this.client.userAgent());
        return client.getAzureClient().getPutOrPatchResultAsync(observable, new TypeToken<WebhookInner>() { }.getType());
    }

    /**
     * Creates a webhook for a container registry with the specified parameters.
     *
     * @param resourceGroupName The name of the resource group to which the container registry belongs.
     * @param registryName The name of the container registry.
     * @param webhookName The name of the webhook.
     * @param webhookCreateParameters The parameters for creating a webhook.
     * @throws IllegalArgumentException thrown if parameters fail the validation
     * @throws CloudException thrown if the request is rejected by server
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
     * @return the WebhookInner object if successful.
     */
    public WebhookInner beginCreate(String resourceGroupName, String registryName, String webhookName, WebhookCreateParameters webhookCreateParameters) {
        return beginCreateWithServiceResponseAsync(resourceGroupName, registryName, webhookName, webhookCreateParameters).toBlocking().single().body();
    }

    /**
     * Creates a webhook for a container registry with the specified parameters.
     *
     * @param resourceGroupName The name of the resource group to which the container registry belongs.
     * @param registryName The name of the container registry.
     * @param webhookName The name of the webhook.
     * @param webhookCreateParameters The parameters for creating a webhook.
     * @param serviceCallback the async ServiceCallback to handle successful and failed responses.
     * @throws IllegalArgumentException thrown if parameters fail the validation
     * @return the {@link ServiceFuture} object
     */
    public ServiceFuture<WebhookInner> beginCreateAsync(String resourceGroupName, String registryName, String webhookName, WebhookCreateParameters webhookCreateParameters, final ServiceCallback<WebhookInner> serviceCallback) {
        return ServiceFuture.fromResponse(beginCreateWithServiceResponseAsync(resourceGroupName, registryName, webhookName, webhookCreateParameters), serviceCallback);
    }

    /**
     * Creates a webhook for a container registry with the specified parameters.
     *
     * @param resourceGroupName The name of the resource group to which the container registry belongs.
     * @param registryName The name of the container registry.
     * @param webhookName The name of the webhook.
     * @param webhookCreateParameters The parameters for creating a webhook.
     * @throws IllegalArgumentException thrown if parameters fail the validation
     * @return the observable to the WebhookInner object
     */
    public Observable<WebhookInner> beginCreateAsync(String resourceGroupName, String registryName, String webhookName, WebhookCreateParameters webhookCreateParameters) {
        return beginCreateWithServiceResponseAsync(resourceGroupName, registryName, webhookName, webhookCreateParameters).map(new Func1<ServiceResponse<WebhookInner>, WebhookInner>() {
            @Override
            public WebhookInner call(ServiceResponse<WebhookInner> response) {
                return response.body();
            }
        });
    }

    /**
     * Creates a webhook for a container registry with the specified parameters.
     *
     * @param resourceGroupName The name of the resource group to which the container registry belongs.
     * @param registryName The name of the container registry.
     * @param webhookName The name of the webhook.
     * @param webhookCreateParameters The parameters for creating a webhook.
     * @throws IllegalArgumentException thrown if parameters fail the validation
     * @return the observable to the WebhookInner object
     */
    public Observable<ServiceResponse<WebhookInner>> beginCreateWithServiceResponseAsync(String resourceGroupName, String registryName, String webhookName, WebhookCreateParameters webhookCreateParameters) {
        if (this.client.subscriptionId() == null) {
            throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null.");
        }
        if (resourceGroupName == null) {
            throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.");
        }
        if (registryName == null) {
            throw new IllegalArgumentException("Parameter registryName is required and cannot be null.");
        }
        if (webhookName == null) {
            throw new IllegalArgumentException("Parameter webhookName is required and cannot be null.");
        }
        if (webhookCreateParameters == null) {
            throw new IllegalArgumentException("Parameter webhookCreateParameters is required and cannot be null.");
        }
        Validator.validate(webhookCreateParameters);
        final String apiVersion = "2017-10-01";
        return service.beginCreate(this.client.subscriptionId(), resourceGroupName, registryName, webhookName, apiVersion, webhookCreateParameters, this.client.acceptLanguage(), this.client.userAgent())
            .flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<WebhookInner>>>() {
                @Override
                public Observable<ServiceResponse<WebhookInner>> call(Response<ResponseBody> response) {
                    try {
                        ServiceResponse<WebhookInner> clientResponse = beginCreateDelegate(response);
                        return Observable.just(clientResponse);
                    } catch (Throwable t) {
                        return Observable.error(t);
                    }
                }
            });
    }

    private ServiceResponse<WebhookInner> beginCreateDelegate(Response<ResponseBody> response) throws CloudException, IOException, IllegalArgumentException {
        return this.client.restClient().responseBuilderFactory().<WebhookInner, CloudException>newInstance(this.client.serializerAdapter())
                .register(200, new TypeToken<WebhookInner>() { }.getType())
                .register(201, new TypeToken<WebhookInner>() { }.getType())
                .registerError(CloudException.class)
                .build(response);
    }

    /**
     * Deletes a webhook from a container registry.
     *
     * @param resourceGroupName The name of the resource group to which the container registry belongs.
     * @param registryName The name of the container registry.
     * @param webhookName The name of the webhook.
     * @throws IllegalArgumentException thrown if parameters fail the validation
     * @throws CloudException thrown if the request is rejected by server
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
     */
    public void delete(String resourceGroupName, String registryName, String webhookName) {
        deleteWithServiceResponseAsync(resourceGroupName, registryName, webhookName).toBlocking().last().body();
    }

    /**
     * Deletes a webhook from a container registry.
     *
     * @param resourceGroupName The name of the resource group to which the container registry belongs.
     * @param registryName The name of the container registry.
     * @param webhookName The name of the webhook.
     * @param serviceCallback the async ServiceCallback to handle successful and failed responses.
     * @throws IllegalArgumentException thrown if parameters fail the validation
     * @return the {@link ServiceFuture} object
     */
    public ServiceFuture<Void> deleteAsync(String resourceGroupName, String registryName, String webhookName, final ServiceCallback<Void> serviceCallback) {
        return ServiceFuture.fromResponse(deleteWithServiceResponseAsync(resourceGroupName, registryName, webhookName), serviceCallback);
    }

    /**
     * Deletes a webhook from a container registry.
     *
     * @param resourceGroupName The name of the resource group to which the container registry belongs.
     * @param registryName The name of the container registry.
     * @param webhookName The name of the webhook.
     * @throws IllegalArgumentException thrown if parameters fail the validation
     * @return the observable for the request
     */
    public Observable<Void> deleteAsync(String resourceGroupName, String registryName, String webhookName) {
        return deleteWithServiceResponseAsync(resourceGroupName, registryName, webhookName).map(new Func1<ServiceResponse<Void>, Void>() {
            @Override
            public Void call(ServiceResponse<Void> response) {
                return response.body();
            }
        });
    }

    /**
     * Deletes a webhook from a container registry.
     *
     * @param resourceGroupName The name of the resource group to which the container registry belongs.
     * @param registryName The name of the container registry.
     * @param webhookName The name of the webhook.
     * @throws IllegalArgumentException thrown if parameters fail the validation
     * @return the observable for the request
     */
    public Observable<ServiceResponse<Void>> deleteWithServiceResponseAsync(String resourceGroupName, String registryName, String webhookName) {
        if (this.client.subscriptionId() == null) {
            throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null.");
        }
        if (resourceGroupName == null) {
            throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.");
        }
        if (registryName == null) {
            throw new IllegalArgumentException("Parameter registryName is required and cannot be null.");
        }
        if (webhookName == null) {
            throw new IllegalArgumentException("Parameter webhookName is required and cannot be null.");
        }
        final String apiVersion = "2017-10-01";
        Observable<Response<ResponseBody>> observable = service.delete(this.client.subscriptionId(), resourceGroupName, registryName, webhookName, apiVersion, this.client.acceptLanguage(), this.client.userAgent());
        return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken<Void>() { }.getType());
    }

    /**
     * Deletes a webhook from a container registry.
     *
     * @param resourceGroupName The name of the resource group to which the container registry belongs.
     * @param registryName The name of the container registry.
     * @param webhookName The name of the webhook.
     * @throws IllegalArgumentException thrown if parameters fail the validation
     * @throws CloudException thrown if the request is rejected by server
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
     */
    public void beginDelete(String resourceGroupName, String registryName, String webhookName) {
        beginDeleteWithServiceResponseAsync(resourceGroupName, registryName, webhookName).toBlocking().single().body();
    }

    /**
     * Deletes a webhook from a container registry.
     *
     * @param resourceGroupName The name of the resource group to which the container registry belongs.
     * @param registryName The name of the container registry.
     * @param webhookName The name of the webhook.
     * @param serviceCallback the async ServiceCallback to handle successful and failed responses.
     * @throws IllegalArgumentException thrown if parameters fail the validation
     * @return the {@link ServiceFuture} object
     */
    public ServiceFuture<Void> beginDeleteAsync(String resourceGroupName, String registryName, String webhookName, final ServiceCallback<Void> serviceCallback) {
        return ServiceFuture.fromResponse(beginDeleteWithServiceResponseAsync(resourceGroupName, registryName, webhookName), serviceCallback);
    }

    /**
     * Deletes a webhook from a container registry.
     *
     * @param resourceGroupName The name of the resource group to which the container registry belongs.
     * @param registryName The name of the container registry.
     * @param webhookName The name of the webhook.
     * @throws IllegalArgumentException thrown if parameters fail the validation
     * @return the {@link ServiceResponse} object if successful.
     */
    public Observable<Void> beginDeleteAsync(String resourceGroupName, String registryName, String webhookName) {
        return beginDeleteWithServiceResponseAsync(resourceGroupName, registryName, webhookName).map(new Func1<ServiceResponse<Void>, Void>() {
            @Override
            public Void call(ServiceResponse<Void> response) {
                return response.body();
            }
        });
    }

    /**
     * Deletes a webhook from a container registry.
     *
     * @param resourceGroupName The name of the resource group to which the container registry belongs.
     * @param registryName The name of the container registry.
     * @param webhookName The name of the webhook.
     * @throws IllegalArgumentException thrown if parameters fail the validation
     * @return the {@link ServiceResponse} object if successful.
     */
    public Observable<ServiceResponse<Void>> beginDeleteWithServiceResponseAsync(String resourceGroupName, String registryName, String webhookName) {
        if (this.client.subscriptionId() == null) {
            throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null.");
        }
        if (resourceGroupName == null) {
            throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.");
        }
        if (registryName == null) {
            throw new IllegalArgumentException("Parameter registryName is required and cannot be null.");
        }
        if (webhookName == null) {
            throw new IllegalArgumentException("Parameter webhookName is required and cannot be null.");
        }
        final String apiVersion = "2017-10-01";
        return service.beginDelete(this.client.subscriptionId(), resourceGroupName, registryName, webhookName, apiVersion, this.client.acceptLanguage(), this.client.userAgent())
            .flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<Void>>>() {
                @Override
                public Observable<ServiceResponse<Void>> call(Response<ResponseBody> response) {
                    try {
                        ServiceResponse<Void> clientResponse = beginDeleteDelegate(response);
                        return Observable.just(clientResponse);
                    } catch (Throwable t) {
                        return Observable.error(t);
                    }
                }
            });
    }

    private ServiceResponse<Void> beginDeleteDelegate(Response<ResponseBody> response) throws CloudException, IOException, IllegalArgumentException {
        return this.client.restClient().responseBuilderFactory().<Void, CloudException>newInstance(this.client.serializerAdapter())
                .register(200, new TypeToken<Void>() { }.getType())
                .register(202, new TypeToken<Void>() { }.getType())
                .register(204, new TypeToken<Void>() { }.getType())
                .registerError(CloudException.class)
                .build(response);
    }

    /**
     * Updates a webhook with the specified parameters.
     *
     * @param resourceGroupName The name of the resource group to which the container registry belongs.
     * @param registryName The name of the container registry.
     * @param webhookName The name of the webhook.
     * @param webhookUpdateParameters The parameters for updating a webhook.
     * @throws IllegalArgumentException thrown if parameters fail the validation
     * @throws CloudException thrown if the request is rejected by server
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
     * @return the WebhookInner object if successful.
     */
    public WebhookInner update(String resourceGroupName, String registryName, String webhookName, WebhookUpdateParameters webhookUpdateParameters) {
        return updateWithServiceResponseAsync(resourceGroupName, registryName, webhookName, webhookUpdateParameters).toBlocking().last().body();
    }

    /**
     * Updates a webhook with the specified parameters.
     *
     * @param resourceGroupName The name of the resource group to which the container registry belongs.
     * @param registryName The name of the container registry.
     * @param webhookName The name of the webhook.
     * @param webhookUpdateParameters The parameters for updating a webhook.
     * @param serviceCallback the async ServiceCallback to handle successful and failed responses.
     * @throws IllegalArgumentException thrown if parameters fail the validation
     * @return the {@link ServiceFuture} object
     */
    public ServiceFuture<WebhookInner> updateAsync(String resourceGroupName, String registryName, String webhookName, WebhookUpdateParameters webhookUpdateParameters, final ServiceCallback<WebhookInner> serviceCallback) {
        return ServiceFuture.fromResponse(updateWithServiceResponseAsync(resourceGroupName, registryName, webhookName, webhookUpdateParameters), serviceCallback);
    }

    /**
     * Updates a webhook with the specified parameters.
     *
     * @param resourceGroupName The name of the resource group to which the container registry belongs.
     * @param registryName The name of the container registry.
     * @param webhookName The name of the webhook.
     * @param webhookUpdateParameters The parameters for updating a webhook.
     * @throws IllegalArgumentException thrown if parameters fail the validation
     * @return the observable for the request
     */
    public Observable<WebhookInner> updateAsync(String resourceGroupName, String registryName, String webhookName, WebhookUpdateParameters webhookUpdateParameters) {
        return updateWithServiceResponseAsync(resourceGroupName, registryName, webhookName, webhookUpdateParameters).map(new Func1<ServiceResponse<WebhookInner>, WebhookInner>() {
            @Override
            public WebhookInner call(ServiceResponse<WebhookInner> response) {
                return response.body();
            }
        });
    }

    /**
     * Updates a webhook with the specified parameters.
     *
     * @param resourceGroupName The name of the resource group to which the container registry belongs.
     * @param registryName The name of the container registry.
     * @param webhookName The name of the webhook.
     * @param webhookUpdateParameters The parameters for updating a webhook.
     * @throws IllegalArgumentException thrown if parameters fail the validation
     * @return the observable for the request
     */
    public Observable<ServiceResponse<WebhookInner>> updateWithServiceResponseAsync(String resourceGroupName, String registryName, String webhookName, WebhookUpdateParameters webhookUpdateParameters) {
        if (this.client.subscriptionId() == null) {
            throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null.");
        }
        if (resourceGroupName == null) {
            throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.");
        }
        if (registryName == null) {
            throw new IllegalArgumentException("Parameter registryName is required and cannot be null.");
        }
        if (webhookName == null) {
            throw new IllegalArgumentException("Parameter webhookName is required and cannot be null.");
        }
        if (webhookUpdateParameters == null) {
            throw new IllegalArgumentException("Parameter webhookUpdateParameters is required and cannot be null.");
        }
        Validator.validate(webhookUpdateParameters);
        final String apiVersion = "2017-10-01";
        Observable<Response<ResponseBody>> observable = service.update(this.client.subscriptionId(), resourceGroupName, registryName, webhookName, apiVersion, webhookUpdateParameters, this.client.acceptLanguage(), this.client.userAgent());
        return client.getAzureClient().getPutOrPatchResultAsync(observable, new TypeToken<WebhookInner>() { }.getType());
    }

    /**
     * Updates a webhook with the specified parameters.
     *
     * @param resourceGroupName The name of the resource group to which the container registry belongs.
     * @param registryName The name of the container registry.
     * @param webhookName The name of the webhook.
     * @param webhookUpdateParameters The parameters for updating a webhook.
     * @throws IllegalArgumentException thrown if parameters fail the validation
     * @throws CloudException thrown if the request is rejected by server
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
     * @return the WebhookInner object if successful.
     */
    public WebhookInner beginUpdate(String resourceGroupName, String registryName, String webhookName, WebhookUpdateParameters webhookUpdateParameters) {
        return beginUpdateWithServiceResponseAsync(resourceGroupName, registryName, webhookName, webhookUpdateParameters).toBlocking().single().body();
    }

    /**
     * Updates a webhook with the specified parameters.
     *
     * @param resourceGroupName The name of the resource group to which the container registry belongs.
     * @param registryName The name of the container registry.
     * @param webhookName The name of the webhook.
     * @param webhookUpdateParameters The parameters for updating a webhook.
     * @param serviceCallback the async ServiceCallback to handle successful and failed responses.
     * @throws IllegalArgumentException thrown if parameters fail the validation
     * @return the {@link ServiceFuture} object
     */
    public ServiceFuture<WebhookInner> beginUpdateAsync(String resourceGroupName, String registryName, String webhookName, WebhookUpdateParameters webhookUpdateParameters, final ServiceCallback<WebhookInner> serviceCallback) {
        return ServiceFuture.fromResponse(beginUpdateWithServiceResponseAsync(resourceGroupName, registryName, webhookName, webhookUpdateParameters), serviceCallback);
    }

    /**
     * Updates a webhook with the specified parameters.
     *
     * @param resourceGroupName The name of the resource group to which the container registry belongs.
     * @param registryName The name of the container registry.
     * @param webhookName The name of the webhook.
     * @param webhookUpdateParameters The parameters for updating a webhook.
     * @throws IllegalArgumentException thrown if parameters fail the validation
     * @return the observable to the WebhookInner object
     */
    public Observable<WebhookInner> beginUpdateAsync(String resourceGroupName, String registryName, String webhookName, WebhookUpdateParameters webhookUpdateParameters) {
        return beginUpdateWithServiceResponseAsync(resourceGroupName, registryName, webhookName, webhookUpdateParameters).map(new Func1<ServiceResponse<WebhookInner>, WebhookInner>() {
            @Override
            public WebhookInner call(ServiceResponse<WebhookInner> response) {
                return response.body();
            }
        });
    }

    /**
     * Updates a webhook with the specified parameters.
     *
     * @param resourceGroupName The name of the resource group to which the container registry belongs.
     * @param registryName The name of the container registry.
     * @param webhookName The name of the webhook.
     * @param webhookUpdateParameters The parameters for updating a webhook.
     * @throws IllegalArgumentException thrown if parameters fail the validation
     * @return the observable to the WebhookInner object
     */
    public Observable<ServiceResponse<WebhookInner>> beginUpdateWithServiceResponseAsync(String resourceGroupName, String registryName, String webhookName, WebhookUpdateParameters webhookUpdateParameters) {
        if (this.client.subscriptionId() == null) {
            throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null.");
        }
        if (resourceGroupName == null) {
            throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.");
        }
        if (registryName == null) {
            throw new IllegalArgumentException("Parameter registryName is required and cannot be null.");
        }
        if (webhookName == null) {
            throw new IllegalArgumentException("Parameter webhookName is required and cannot be null.");
        }
        if (webhookUpdateParameters == null) {
            throw new IllegalArgumentException("Parameter webhookUpdateParameters is required and cannot be null.");
        }
        Validator.validate(webhookUpdateParameters);
        final String apiVersion = "2017-10-01";
        return service.beginUpdate(this.client.subscriptionId(), resourceGroupName, registryName, webhookName, apiVersion, webhookUpdateParameters, this.client.acceptLanguage(), this.client.userAgent())
            .flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<WebhookInner>>>() {
                @Override
                public Observable<ServiceResponse<WebhookInner>> call(Response<ResponseBody> response) {
                    try {
                        ServiceResponse<WebhookInner> clientResponse = beginUpdateDelegate(response);
                        return Observable.just(clientResponse);
                    } catch (Throwable t) {
                        return Observable.error(t);
                    }
                }
            });
    }

    private ServiceResponse<WebhookInner> beginUpdateDelegate(Response<ResponseBody> response) throws CloudException, IOException, IllegalArgumentException {
        return this.client.restClient().responseBuilderFactory().<WebhookInner, CloudException>newInstance(this.client.serializerAdapter())
                .register(200, new TypeToken<WebhookInner>() { }.getType())
                .register(201, new TypeToken<WebhookInner>() { }.getType())
                .registerError(CloudException.class)
                .build(response);
    }

    /**
     * Lists all the webhooks for the specified container registry.
     *
     * @param resourceGroupName The name of the resource group to which the container registry belongs.
     * @param registryName The name of the container registry.
     * @throws IllegalArgumentException thrown if parameters fail the validation
     * @throws CloudException thrown if the request is rejected by server
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
     * @return the PagedList<WebhookInner> object if successful.
     */
    public PagedList<WebhookInner> list(final String resourceGroupName, final String registryName) {
        ServiceResponse<Page<WebhookInner>> response = listSinglePageAsync(resourceGroupName, registryName).toBlocking().single();
        return new PagedList<WebhookInner>(response.body()) {
            @Override
            public Page<WebhookInner> nextPage(String nextPageLink) {
                return listNextSinglePageAsync(nextPageLink).toBlocking().single().body();
            }
        };
    }

    /**
     * Lists all the webhooks for the specified container registry.
     *
     * @param resourceGroupName The name of the resource group to which the container registry belongs.
     * @param registryName The name of the container registry.
     * @param serviceCallback the async ServiceCallback to handle successful and failed responses.
     * @throws IllegalArgumentException thrown if parameters fail the validation
     * @return the {@link ServiceFuture} object
     */
    public ServiceFuture<List<WebhookInner>> listAsync(final String resourceGroupName, final String registryName, final ListOperationCallback<WebhookInner> serviceCallback) {
        return AzureServiceFuture.fromPageResponse(
            listSinglePageAsync(resourceGroupName, registryName),
            new Func1<String, Observable<ServiceResponse<Page<WebhookInner>>>>() {
                @Override
                public Observable<ServiceResponse<Page<WebhookInner>>> call(String nextPageLink) {
                    return listNextSinglePageAsync(nextPageLink);
                }
            },
            serviceCallback);
    }

    /**
     * Lists all the webhooks for the specified container registry.
     *
     * @param resourceGroupName The name of the resource group to which the container registry belongs.
     * @param registryName The name of the container registry.
     * @throws IllegalArgumentException thrown if parameters fail the validation
     * @return the observable to the PagedList<WebhookInner> object
     */
    public Observable<Page<WebhookInner>> listAsync(final String resourceGroupName, final String registryName) {
        return listWithServiceResponseAsync(resourceGroupName, registryName)
            .map(new Func1<ServiceResponse<Page<WebhookInner>>, Page<WebhookInner>>() {
                @Override
                public Page<WebhookInner> call(ServiceResponse<Page<WebhookInner>> response) {
                    return response.body();
                }
            });
    }

    /**
     * Lists all the webhooks for the specified container registry.
     *
     * @param resourceGroupName The name of the resource group to which the container registry belongs.
     * @param registryName The name of the container registry.
     * @throws IllegalArgumentException thrown if parameters fail the validation
     * @return the observable to the PagedList<WebhookInner> object
     */
    public Observable<ServiceResponse<Page<WebhookInner>>> listWithServiceResponseAsync(final String resourceGroupName, final String registryName) {
        return listSinglePageAsync(resourceGroupName, registryName)
            .concatMap(new Func1<ServiceResponse<Page<WebhookInner>>, Observable<ServiceResponse<Page<WebhookInner>>>>() {
                @Override
                public Observable<ServiceResponse<Page<WebhookInner>>> call(ServiceResponse<Page<WebhookInner>> page) {
                    String nextPageLink = page.body().nextPageLink();
                    if (nextPageLink == null) {
                        return Observable.just(page);
                    }
                    return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink));
                }
            });
    }

    /**
     * Lists all the webhooks for the specified container registry.
     *
    ServiceResponse<PageImpl<WebhookInner>> * @param resourceGroupName The name of the resource group to which the container registry belongs.
    ServiceResponse<PageImpl<WebhookInner>> * @param registryName The name of the container registry.
     * @throws IllegalArgumentException thrown if parameters fail the validation
     * @return the PagedList<WebhookInner> object wrapped in {@link ServiceResponse} if successful.
     */
    public Observable<ServiceResponse<Page<WebhookInner>>> listSinglePageAsync(final String resourceGroupName, final String registryName) {
        if (this.client.subscriptionId() == null) {
            throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null.");
        }
        if (resourceGroupName == null) {
            throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.");
        }
        if (registryName == null) {
            throw new IllegalArgumentException("Parameter registryName is required and cannot be null.");
        }
        final String apiVersion = "2017-10-01";
        return service.list(this.client.subscriptionId(), resourceGroupName, registryName, apiVersion, this.client.acceptLanguage(), this.client.userAgent())
            .flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<Page<WebhookInner>>>>() {
                @Override
                public Observable<ServiceResponse<Page<WebhookInner>>> call(Response<ResponseBody> response) {
                    try {
                        ServiceResponse<PageImpl<WebhookInner>> result = listDelegate(response);
                        return Observable.just(new ServiceResponse<Page<WebhookInner>>(result.body(), result.response()));
                    } catch (Throwable t) {
                        return Observable.error(t);
                    }
                }
            });
    }

    private ServiceResponse<PageImpl<WebhookInner>> listDelegate(Response<ResponseBody> response) throws CloudException, IOException, IllegalArgumentException {
        return this.client.restClient().responseBuilderFactory().<PageImpl<WebhookInner>, CloudException>newInstance(this.client.serializerAdapter())
                .register(200, new TypeToken<PageImpl<WebhookInner>>() { }.getType())
                .registerError(CloudException.class)
                .build(response);
    }

    /**
     * Triggers a ping event to be sent to the webhook.
     *
     * @param resourceGroupName The name of the resource group to which the container registry belongs.
     * @param registryName The name of the container registry.
     * @param webhookName The name of the webhook.
     * @throws IllegalArgumentException thrown if parameters fail the validation
     * @throws CloudException thrown if the request is rejected by server
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
     * @return the EventInfoInner object if successful.
     */
    public EventInfoInner ping(String resourceGroupName, String registryName, String webhookName) {
        return pingWithServiceResponseAsync(resourceGroupName, registryName, webhookName).toBlocking().single().body();
    }

    /**
     * Triggers a ping event to be sent to the webhook.
     *
     * @param resourceGroupName The name of the resource group to which the container registry belongs.
     * @param registryName The name of the container registry.
     * @param webhookName The name of the webhook.
     * @param serviceCallback the async ServiceCallback to handle successful and failed responses.
     * @throws IllegalArgumentException thrown if parameters fail the validation
     * @return the {@link ServiceFuture} object
     */
    public ServiceFuture<EventInfoInner> pingAsync(String resourceGroupName, String registryName, String webhookName, final ServiceCallback<EventInfoInner> serviceCallback) {
        return ServiceFuture.fromResponse(pingWithServiceResponseAsync(resourceGroupName, registryName, webhookName), serviceCallback);
    }

    /**
     * Triggers a ping event to be sent to the webhook.
     *
     * @param resourceGroupName The name of the resource group to which the container registry belongs.
     * @param registryName The name of the container registry.
     * @param webhookName The name of the webhook.
     * @throws IllegalArgumentException thrown if parameters fail the validation
     * @return the observable to the EventInfoInner object
     */
    public Observable<EventInfoInner> pingAsync(String resourceGroupName, String registryName, String webhookName) {
        return pingWithServiceResponseAsync(resourceGroupName, registryName, webhookName).map(new Func1<ServiceResponse<EventInfoInner>, EventInfoInner>() {
            @Override
            public EventInfoInner call(ServiceResponse<EventInfoInner> response) {
                return response.body();
            }
        });
    }

    /**
     * Triggers a ping event to be sent to the webhook.
     *
     * @param resourceGroupName The name of the resource group to which the container registry belongs.
     * @param registryName The name of the container registry.
     * @param webhookName The name of the webhook.
     * @throws IllegalArgumentException thrown if parameters fail the validation
     * @return the observable to the EventInfoInner object
     */
    public Observable<ServiceResponse<EventInfoInner>> pingWithServiceResponseAsync(String resourceGroupName, String registryName, String webhookName) {
        if (this.client.subscriptionId() == null) {
            throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null.");
        }
        if (resourceGroupName == null) {
            throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.");
        }
        if (registryName == null) {
            throw new IllegalArgumentException("Parameter registryName is required and cannot be null.");
        }
        if (webhookName == null) {
            throw new IllegalArgumentException("Parameter webhookName is required and cannot be null.");
        }
        final String apiVersion = "2017-10-01";
        return service.ping(this.client.subscriptionId(), resourceGroupName, registryName, webhookName, apiVersion, this.client.acceptLanguage(), this.client.userAgent())
            .flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<EventInfoInner>>>() {
                @Override
                public Observable<ServiceResponse<EventInfoInner>> call(Response<ResponseBody> response) {
                    try {
                        ServiceResponse<EventInfoInner> clientResponse = pingDelegate(response);
                        return Observable.just(clientResponse);
                    } catch (Throwable t) {
                        return Observable.error(t);
                    }
                }
            });
    }

    private ServiceResponse<EventInfoInner> pingDelegate(Response<ResponseBody> response) throws CloudException, IOException, IllegalArgumentException {
        return this.client.restClient().responseBuilderFactory().<EventInfoInner, CloudException>newInstance(this.client.serializerAdapter())
                .register(200, new TypeToken<EventInfoInner>() { }.getType())
                .registerError(CloudException.class)
                .build(response);
    }

    /**
     * Gets the configuration of service URI and custom headers for the webhook.
     *
     * @param resourceGroupName The name of the resource group to which the container registry belongs.
     * @param registryName The name of the container registry.
     * @param webhookName The name of the webhook.
     * @throws IllegalArgumentException thrown if parameters fail the validation
     * @throws CloudException thrown if the request is rejected by server
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
     * @return the CallbackConfigInner object if successful.
     */
    public CallbackConfigInner getCallbackConfig(String resourceGroupName, String registryName, String webhookName) {
        return getCallbackConfigWithServiceResponseAsync(resourceGroupName, registryName, webhookName).toBlocking().single().body();
    }

    /**
     * Gets the configuration of service URI and custom headers for the webhook.
     *
     * @param resourceGroupName The name of the resource group to which the container registry belongs.
     * @param registryName The name of the container registry.
     * @param webhookName The name of the webhook.
     * @param serviceCallback the async ServiceCallback to handle successful and failed responses.
     * @throws IllegalArgumentException thrown if parameters fail the validation
     * @return the {@link ServiceFuture} object
     */
    public ServiceFuture<CallbackConfigInner> getCallbackConfigAsync(String resourceGroupName, String registryName, String webhookName, final ServiceCallback<CallbackConfigInner> serviceCallback) {
        return ServiceFuture.fromResponse(getCallbackConfigWithServiceResponseAsync(resourceGroupName, registryName, webhookName), serviceCallback);
    }

    /**
     * Gets the configuration of service URI and custom headers for the webhook.
     *
     * @param resourceGroupName The name of the resource group to which the container registry belongs.
     * @param registryName The name of the container registry.
     * @param webhookName The name of the webhook.
     * @throws IllegalArgumentException thrown if parameters fail the validation
     * @return the observable to the CallbackConfigInner object
     */
    public Observable<CallbackConfigInner> getCallbackConfigAsync(String resourceGroupName, String registryName, String webhookName) {
        return getCallbackConfigWithServiceResponseAsync(resourceGroupName, registryName, webhookName).map(new Func1<ServiceResponse<CallbackConfigInner>, CallbackConfigInner>() {
            @Override
            public CallbackConfigInner call(ServiceResponse<CallbackConfigInner> response) {
                return response.body();
            }
        });
    }

    /**
     * Gets the configuration of service URI and custom headers for the webhook.
     *
     * @param resourceGroupName The name of the resource group to which the container registry belongs.
     * @param registryName The name of the container registry.
     * @param webhookName The name of the webhook.
     * @throws IllegalArgumentException thrown if parameters fail the validation
     * @return the observable to the CallbackConfigInner object
     */
    public Observable<ServiceResponse<CallbackConfigInner>> getCallbackConfigWithServiceResponseAsync(String resourceGroupName, String registryName, String webhookName) {
        if (this.client.subscriptionId() == null) {
            throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null.");
        }
        if (resourceGroupName == null) {
            throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.");
        }
        if (registryName == null) {
            throw new IllegalArgumentException("Parameter registryName is required and cannot be null.");
        }
        if (webhookName == null) {
            throw new IllegalArgumentException("Parameter webhookName is required and cannot be null.");
        }
        final String apiVersion = "2017-10-01";
        return service.getCallbackConfig(this.client.subscriptionId(), resourceGroupName, registryName, webhookName, apiVersion, this.client.acceptLanguage(), this.client.userAgent())
            .flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<CallbackConfigInner>>>() {
                @Override
                public Observable<ServiceResponse<CallbackConfigInner>> call(Response<ResponseBody> response) {
                    try {
                        ServiceResponse<CallbackConfigInner> clientResponse = getCallbackConfigDelegate(response);
                        return Observable.just(clientResponse);
                    } catch (Throwable t) {
                        return Observable.error(t);
                    }
                }
            });
    }

    private ServiceResponse<CallbackConfigInner> getCallbackConfigDelegate(Response<ResponseBody> response) throws CloudException, IOException, IllegalArgumentException {
        return this.client.restClient().responseBuilderFactory().<CallbackConfigInner, CloudException>newInstance(this.client.serializerAdapter())
                .register(200, new TypeToken<CallbackConfigInner>() { }.getType())
                .registerError(CloudException.class)
                .build(response);
    }

    /**
     * Lists recent events for the specified webhook.
     *
     * @param resourceGroupName The name of the resource group to which the container registry belongs.
     * @param registryName The name of the container registry.
     * @param webhookName The name of the webhook.
     * @throws IllegalArgumentException thrown if parameters fail the validation
     * @throws CloudException thrown if the request is rejected by server
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
     * @return the PagedList<EventInner> object if successful.
     */
    public PagedList<EventInner> listEvents(final String resourceGroupName, final String registryName, final String webhookName) {
        ServiceResponse<Page<EventInner>> response = listEventsSinglePageAsync(resourceGroupName, registryName, webhookName).toBlocking().single();
        return new PagedList<EventInner>(response.body()) {
            @Override
            public Page<EventInner> nextPage(String nextPageLink) {
                return listEventsNextSinglePageAsync(nextPageLink).toBlocking().single().body();
            }
        };
    }

    /**
     * Lists recent events for the specified webhook.
     *
     * @param resourceGroupName The name of the resource group to which the container registry belongs.
     * @param registryName The name of the container registry.
     * @param webhookName The name of the webhook.
     * @param serviceCallback the async ServiceCallback to handle successful and failed responses.
     * @throws IllegalArgumentException thrown if parameters fail the validation
     * @return the {@link ServiceFuture} object
     */
    public ServiceFuture<List<EventInner>> listEventsAsync(final String resourceGroupName, final String registryName, final String webhookName, final ListOperationCallback<EventInner> serviceCallback) {
        return AzureServiceFuture.fromPageResponse(
            listEventsSinglePageAsync(resourceGroupName, registryName, webhookName),
            new Func1<String, Observable<ServiceResponse<Page<EventInner>>>>() {
                @Override
                public Observable<ServiceResponse<Page<EventInner>>> call(String nextPageLink) {
                    return listEventsNextSinglePageAsync(nextPageLink);
                }
            },
            serviceCallback);
    }

    /**
     * Lists recent events for the specified webhook.
     *
     * @param resourceGroupName The name of the resource group to which the container registry belongs.
     * @param registryName The name of the container registry.
     * @param webhookName The name of the webhook.
     * @throws IllegalArgumentException thrown if parameters fail the validation
     * @return the observable to the PagedList<EventInner> object
     */
    public Observable<Page<EventInner>> listEventsAsync(final String resourceGroupName, final String registryName, final String webhookName) {
        return listEventsWithServiceResponseAsync(resourceGroupName, registryName, webhookName)
            .map(new Func1<ServiceResponse<Page<EventInner>>, Page<EventInner>>() {
                @Override
                public Page<EventInner> call(ServiceResponse<Page<EventInner>> response) {
                    return response.body();
                }
            });
    }

    /**
     * Lists recent events for the specified webhook.
     *
     * @param resourceGroupName The name of the resource group to which the container registry belongs.
     * @param registryName The name of the container registry.
     * @param webhookName The name of the webhook.
     * @throws IllegalArgumentException thrown if parameters fail the validation
     * @return the observable to the PagedList<EventInner> object
     */
    public Observable<ServiceResponse<Page<EventInner>>> listEventsWithServiceResponseAsync(final String resourceGroupName, final String registryName, final String webhookName) {
        return listEventsSinglePageAsync(resourceGroupName, registryName, webhookName)
            .concatMap(new Func1<ServiceResponse<Page<EventInner>>, Observable<ServiceResponse<Page<EventInner>>>>() {
                @Override
                public Observable<ServiceResponse<Page<EventInner>>> call(ServiceResponse<Page<EventInner>> page) {
                    String nextPageLink = page.body().nextPageLink();
                    if (nextPageLink == null) {
                        return Observable.just(page);
                    }
                    return Observable.just(page).concatWith(listEventsNextWithServiceResponseAsync(nextPageLink));
                }
            });
    }

    /**
     * Lists recent events for the specified webhook.
     *
    ServiceResponse<PageImpl<EventInner>> * @param resourceGroupName The name of the resource group to which the container registry belongs.
    ServiceResponse<PageImpl<EventInner>> * @param registryName The name of the container registry.
    ServiceResponse<PageImpl<EventInner>> * @param webhookName The name of the webhook.
     * @throws IllegalArgumentException thrown if parameters fail the validation
     * @return the PagedList<EventInner> object wrapped in {@link ServiceResponse} if successful.
     */
    public Observable<ServiceResponse<Page<EventInner>>> listEventsSinglePageAsync(final String resourceGroupName, final String registryName, final String webhookName) {
        if (this.client.subscriptionId() == null) {
            throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null.");
        }
        if (resourceGroupName == null) {
            throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.");
        }
        if (registryName == null) {
            throw new IllegalArgumentException("Parameter registryName is required and cannot be null.");
        }
        if (webhookName == null) {
            throw new IllegalArgumentException("Parameter webhookName is required and cannot be null.");
        }
        final String apiVersion = "2017-10-01";
        return service.listEvents(this.client.subscriptionId(), resourceGroupName, registryName, webhookName, apiVersion, this.client.acceptLanguage(), this.client.userAgent())
            .flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<Page<EventInner>>>>() {
                @Override
                public Observable<ServiceResponse<Page<EventInner>>> call(Response<ResponseBody> response) {
                    try {
                        ServiceResponse<PageImpl<EventInner>> result = listEventsDelegate(response);
                        return Observable.just(new ServiceResponse<Page<EventInner>>(result.body(), result.response()));
                    } catch (Throwable t) {
                        return Observable.error(t);
                    }
                }
            });
    }

    private ServiceResponse<PageImpl<EventInner>> listEventsDelegate(Response<ResponseBody> response) throws CloudException, IOException, IllegalArgumentException {
        return this.client.restClient().responseBuilderFactory().<PageImpl<EventInner>, CloudException>newInstance(this.client.serializerAdapter())
                .register(200, new TypeToken<PageImpl<EventInner>>() { }.getType())
                .registerError(CloudException.class)
                .build(response);
    }

    /**
     * Lists all the webhooks for the specified container registry.
     *
     * @param nextPageLink The NextLink from the previous successful call to List operation.
     * @throws IllegalArgumentException thrown if parameters fail the validation
     * @throws CloudException thrown if the request is rejected by server
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
     * @return the PagedList<WebhookInner> object if successful.
     */
    public PagedList<WebhookInner> listNext(final String nextPageLink) {
        ServiceResponse<Page<WebhookInner>> response = listNextSinglePageAsync(nextPageLink).toBlocking().single();
        return new PagedList<WebhookInner>(response.body()) {
            @Override
            public Page<WebhookInner> nextPage(String nextPageLink) {
                return listNextSinglePageAsync(nextPageLink).toBlocking().single().body();
            }
        };
    }

    /**
     * Lists all the webhooks for the specified container registry.
     *
     * @param nextPageLink The NextLink from the previous successful call to List operation.
     * @param serviceFuture the ServiceFuture object tracking the Retrofit calls
     * @param serviceCallback the async ServiceCallback to handle successful and failed responses.
     * @throws IllegalArgumentException thrown if parameters fail the validation
     * @return the {@link ServiceFuture} object
     */
    public ServiceFuture<List<WebhookInner>> listNextAsync(final String nextPageLink, final ServiceFuture<List<WebhookInner>> serviceFuture, final ListOperationCallback<WebhookInner> serviceCallback) {
        return AzureServiceFuture.fromPageResponse(
            listNextSinglePageAsync(nextPageLink),
            new Func1<String, Observable<ServiceResponse<Page<WebhookInner>>>>() {
                @Override
                public Observable<ServiceResponse<Page<WebhookInner>>> call(String nextPageLink) {
                    return listNextSinglePageAsync(nextPageLink);
                }
            },
            serviceCallback);
    }

    /**
     * Lists all the webhooks for the specified container registry.
     *
     * @param nextPageLink The NextLink from the previous successful call to List operation.
     * @throws IllegalArgumentException thrown if parameters fail the validation
     * @return the observable to the PagedList<WebhookInner> object
     */
    public Observable<Page<WebhookInner>> listNextAsync(final String nextPageLink) {
        return listNextWithServiceResponseAsync(nextPageLink)
            .map(new Func1<ServiceResponse<Page<WebhookInner>>, Page<WebhookInner>>() {
                @Override
                public Page<WebhookInner> call(ServiceResponse<Page<WebhookInner>> response) {
                    return response.body();
                }
            });
    }

    /**
     * Lists all the webhooks for the specified container registry.
     *
     * @param nextPageLink The NextLink from the previous successful call to List operation.
     * @throws IllegalArgumentException thrown if parameters fail the validation
     * @return the observable to the PagedList<WebhookInner> object
     */
    public Observable<ServiceResponse<Page<WebhookInner>>> listNextWithServiceResponseAsync(final String nextPageLink) {
        return listNextSinglePageAsync(nextPageLink)
            .concatMap(new Func1<ServiceResponse<Page<WebhookInner>>, Observable<ServiceResponse<Page<WebhookInner>>>>() {
                @Override
                public Observable<ServiceResponse<Page<WebhookInner>>> call(ServiceResponse<Page<WebhookInner>> page) {
                    String nextPageLink = page.body().nextPageLink();
                    if (nextPageLink == null) {
                        return Observable.just(page);
                    }
                    return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink));
                }
            });
    }

    /**
     * Lists all the webhooks for the specified container registry.
     *
    ServiceResponse<PageImpl<WebhookInner>> * @param nextPageLink The NextLink from the previous successful call to List operation.
     * @throws IllegalArgumentException thrown if parameters fail the validation
     * @return the PagedList<WebhookInner> object wrapped in {@link ServiceResponse} if successful.
     */
    public Observable<ServiceResponse<Page<WebhookInner>>> listNextSinglePageAsync(final String nextPageLink) {
        if (nextPageLink == null) {
            throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null.");
        }
        String nextUrl = String.format("%s", nextPageLink);
        return service.listNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent())
            .flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<Page<WebhookInner>>>>() {
                @Override
                public Observable<ServiceResponse<Page<WebhookInner>>> call(Response<ResponseBody> response) {
                    try {
                        ServiceResponse<PageImpl<WebhookInner>> result = listNextDelegate(response);
                        return Observable.just(new ServiceResponse<Page<WebhookInner>>(result.body(), result.response()));
                    } catch (Throwable t) {
                        return Observable.error(t);
                    }
                }
            });
    }

    private ServiceResponse<PageImpl<WebhookInner>> listNextDelegate(Response<ResponseBody> response) throws CloudException, IOException, IllegalArgumentException {
        return this.client.restClient().responseBuilderFactory().<PageImpl<WebhookInner>, CloudException>newInstance(this.client.serializerAdapter())
                .register(200, new TypeToken<PageImpl<WebhookInner>>() { }.getType())
                .registerError(CloudException.class)
                .build(response);
    }

    /**
     * Lists recent events for the specified webhook.
     *
     * @param nextPageLink The NextLink from the previous successful call to List operation.
     * @throws IllegalArgumentException thrown if parameters fail the validation
     * @throws CloudException thrown if the request is rejected by server
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
     * @return the PagedList<EventInner> object if successful.
     */
    public PagedList<EventInner> listEventsNext(final String nextPageLink) {
        ServiceResponse<Page<EventInner>> response = listEventsNextSinglePageAsync(nextPageLink).toBlocking().single();
        return new PagedList<EventInner>(response.body()) {
            @Override
            public Page<EventInner> nextPage(String nextPageLink) {
                return listEventsNextSinglePageAsync(nextPageLink).toBlocking().single().body();
            }
        };
    }

    /**
     * Lists recent events for the specified webhook.
     *
     * @param nextPageLink The NextLink from the previous successful call to List operation.
     * @param serviceFuture the ServiceFuture object tracking the Retrofit calls
     * @param serviceCallback the async ServiceCallback to handle successful and failed responses.
     * @throws IllegalArgumentException thrown if parameters fail the validation
     * @return the {@link ServiceFuture} object
     */
    public ServiceFuture<List<EventInner>> listEventsNextAsync(final String nextPageLink, final ServiceFuture<List<EventInner>> serviceFuture, final ListOperationCallback<EventInner> serviceCallback) {
        return AzureServiceFuture.fromPageResponse(
            listEventsNextSinglePageAsync(nextPageLink),
            new Func1<String, Observable<ServiceResponse<Page<EventInner>>>>() {
                @Override
                public Observable<ServiceResponse<Page<EventInner>>> call(String nextPageLink) {
                    return listEventsNextSinglePageAsync(nextPageLink);
                }
            },
            serviceCallback);
    }

    /**
     * Lists recent events for the specified webhook.
     *
     * @param nextPageLink The NextLink from the previous successful call to List operation.
     * @throws IllegalArgumentException thrown if parameters fail the validation
     * @return the observable to the PagedList<EventInner> object
     */
    public Observable<Page<EventInner>> listEventsNextAsync(final String nextPageLink) {
        return listEventsNextWithServiceResponseAsync(nextPageLink)
            .map(new Func1<ServiceResponse<Page<EventInner>>, Page<EventInner>>() {
                @Override
                public Page<EventInner> call(ServiceResponse<Page<EventInner>> response) {
                    return response.body();
                }
            });
    }

    /**
     * Lists recent events for the specified webhook.
     *
     * @param nextPageLink The NextLink from the previous successful call to List operation.
     * @throws IllegalArgumentException thrown if parameters fail the validation
     * @return the observable to the PagedList<EventInner> object
     */
    public Observable<ServiceResponse<Page<EventInner>>> listEventsNextWithServiceResponseAsync(final String nextPageLink) {
        return listEventsNextSinglePageAsync(nextPageLink)
            .concatMap(new Func1<ServiceResponse<Page<EventInner>>, Observable<ServiceResponse<Page<EventInner>>>>() {
                @Override
                public Observable<ServiceResponse<Page<EventInner>>> call(ServiceResponse<Page<EventInner>> page) {
                    String nextPageLink = page.body().nextPageLink();
                    if (nextPageLink == null) {
                        return Observable.just(page);
                    }
                    return Observable.just(page).concatWith(listEventsNextWithServiceResponseAsync(nextPageLink));
                }
            });
    }

    /**
     * Lists recent events for the specified webhook.
     *
    ServiceResponse<PageImpl<EventInner>> * @param nextPageLink The NextLink from the previous successful call to List operation.
     * @throws IllegalArgumentException thrown if parameters fail the validation
     * @return the PagedList<EventInner> object wrapped in {@link ServiceResponse} if successful.
     */
    public Observable<ServiceResponse<Page<EventInner>>> listEventsNextSinglePageAsync(final String nextPageLink) {
        if (nextPageLink == null) {
            throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null.");
        }
        String nextUrl = String.format("%s", nextPageLink);
        return service.listEventsNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent())
            .flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<Page<EventInner>>>>() {
                @Override
                public Observable<ServiceResponse<Page<EventInner>>> call(Response<ResponseBody> response) {
                    try {
                        ServiceResponse<PageImpl<EventInner>> result = listEventsNextDelegate(response);
                        return Observable.just(new ServiceResponse<Page<EventInner>>(result.body(), result.response()));
                    } catch (Throwable t) {
                        return Observable.error(t);
                    }
                }
            });
    }

    private ServiceResponse<PageImpl<EventInner>> listEventsNextDelegate(Response<ResponseBody> response) throws CloudException, IOException, IllegalArgumentException {
        return this.client.restClient().responseBuilderFactory().<PageImpl<EventInner>, CloudException>newInstance(this.client.serializerAdapter())
                .register(200, new TypeToken<PageImpl<EventInner>>() { }.getType())
                .registerError(CloudException.class)
                .build(response);
    }

}


text:
<?php

namespace CachetHQ\Cachet\Bus\Handlers\Commands\Schedule;

use CachetHQ\Cachet\Bus\Commands\Schedule\UpdateScheduleCommand;
use CachetHQ\Cachet\Bus\Events\Schedule\ScheduleWasUpdatedEvent;
use CachetHQ\Cachet\Dates\DateFactory;
use CachetHQ\Cachet\Models\Schedule;

/**
 * This is the update schedule command handler.
 *
 * @author James Brooks <james@alt-three.com>
 */
class UpdateScheduleCommandHandler
{
    /**
     * The date factory instance.
     *
     * @var \CachetHQ\Cachet\Dates\DateFactory
     */
    protected $dates;

    /**
     * Create a new update schedule command handler instance.
     *
     * @param \CachetHQ\Cachet\Dates\DateFactory $dates
     *
     * @return void
     */
    public function __construct(DateFactory $dates)
    {
        $this->dates = $dates;
    }

    /**
     * Handle the update schedule command.
     *
     * @param \CachetHQ\Cachet\Bus\Commands\Schedule\UpdateScheduleCommand $command
     *
     * @return \CachetHQ\Cachet\Models\Schedule
     */
    public function handle(UpdateScheduleCommand $command)
    {
        $schedule = $command->schedule;

        $schedule->update($this->filter($command));

        event(new ScheduleWasUpdatedEvent($schedule));

        return $schedule;
    }

    /**
     * Filter the command data.
     *
     * @param \CachetHQ\Cachet\Bus\Commands\Schedule\UpdateScheduleCommand $command
     *
     * @return array
     */
    protected function filter(UpdateScheduleCommand $command)
    {
        $params = [
            'name'    => $command->name,
            'message' => $command->message,
            'status'  => $command->status,
        ];

        if ($scheduledAt = $command->scheduled_at) {
            $params['scheduled_at'] = $this->dates->create('Y-m-d H:i', $scheduledAt);
        }

        if ($completedAt = $command->completed_at) {
            $params['completed_at'] = $this->dates->create('Y-m-d H:i', $completedAt);
        }

        $availableParams = array_filter($params, function ($val) {
            return $val !== null;
        });

        return $availableParams;
    }
}

redpajama_set_name: RedPajamaGithub


text:
class ParcelableClass implements android.os.Parcelable {
	public static final android.os.Parcelable.Creator<ParcelableClass> CREATOR = new CreatorImpl();

	byte myByte;
	double myDouble;
	float myFloat;
	int myInt;
	long myLong;

	@java.lang.SuppressWarnings("all")
	public int describeContents() {
		return 0;
	}

	@java.lang.SuppressWarnings("all")
	public void writeToParcel(android.os.Parcel dest, int flags) {
		dest.writeByte(this.myByte);
		dest.writeDouble(this.myDouble);
		dest.writeFloat(this.myFloat);
		dest.writeInt(this.myInt);
		dest.writeLong(this.myLong);
	}

	@java.lang.SuppressWarnings("all")
	protected ParcelableClass(android.os.Parcel source) {
		this.myByte = source.readByte();
		this.myDouble = source.readDouble();
		this.myFloat = source.readFloat();
		this.myInt = source.readInt();
		this.myLong = source.readLong();
	}

	@java.lang.SuppressWarnings("all")
	private static class CreatorImpl implements android.os.Parcelable.Creator<ParcelableClass> {

		@java.lang.SuppressWarnings("all")
		public ParcelableClass createFromParcel(android.os.Parcel source) {
			return new ParcelableClass(source);
		}

		@java.lang.SuppressWarnings("all")
		public ParcelableClass[] newArray(int size) {
			return new ParcelableClass[size];
		}
	}
}


text:
package com.huawei.esdk.ev3.processor;

import com.huawei.esdk.ev3.HDCIDERobot;
import com.huawei.esdk.ev3.common.RobotMoveCmd;
import com.huawei.esdk.ev3.server.Communicator;

public class RobotMoveProcessor implements Processor<RobotMoveCmd> {

	private HDCIDERobot robot;

	public RobotMoveProcessor(HDCIDERobot robot) {
		this.robot = robot;
	}

	@Override
	public void process(RobotMoveCmd msg, Communicator communicator) {
		short speed = msg.getSpeed();
		short angle = msg.getRotation();
		switch (msg.getCommand()) {
		case Forward:
			robot.forward(speed, angle);
			break;
		case Backward:
			robot.backword(speed, angle);
			break;
		case Left:
			robot.left(speed, angle);
			break;
		case Right:
			robot.right(speed, angle);
			break;
		case Float:
//			robot.flt();
			break;
		case Stop:
			robot.stop();
			break;
		}
	}

}


text:
using System.IO;
using System.Text.RegularExpressions;

namespace GenerateQTProject
{
    /// <summary>
    /// This class provides an abstract interface to load defines, includes and engine path from a project file
    /// </summary>
    public abstract class ProjectFileParser
    {
        protected string projectFileContent;

        public string projectPath { get; private set; }
        public string projectName { get; private set; }
        public string uprojectFilePath { get; private set; }

        /// <summary>
        /// Loads content of the code project file into projectFileContent
        /// </summary>
        /// <param name="projectPath">Path to the project folder</param>
        /// <param name="projectName">Name of .uproject file</param>
        public ProjectFileParser(string projectPath, string projectName)
        {
            this.projectPath = projectPath;
            this.projectName = projectName;

            try
            {
                projectFileContent = LoadProjectFile(projectPath, projectName);

                uprojectFilePath = projectPath + projectName + ".uproject";

                if (!File.Exists(uprojectFilePath))
                    Errors.ErrorExit(ErrorCode.UPROJECT_NOT_FOUND);
            }
            catch
            {
                Errors.ErrorExit(ErrorCode.CODE_PROJECT_FILE_READ_FAILED);
            }
        }

        /// <summary>
        /// Loads the project file content
        /// </summary>
        /// <param name="path">Path to the Unreal Engine project folder</param>
        /// <param name="projectName">Name of the .uproject file</param>
        /// <returns>project file content</returns>
        protected abstract string LoadProjectFile(string path, string projectName);

        /// <summary>
        /// Retrieve engine defines in QtCreator format
        /// </summary>
        /// <returns>Qt formatted defines list</returns>
        public string GetEngineDefines()
        {
            string defines  = "";
            try
            {
                defines = ExtractEngineDefines();
            }
            catch
            {
                Errors.ErrorExit(ErrorCode.DEFINES_AND_INCLUDES_READ_FAILED);
            }

            return ConvertDefinesToQtFormat(defines);
        }

        /// <summary>
        /// Retrieve engine includes in QtCreator format
        /// </summary>
        /// <returns>Qt formatted includes list</returns>
        public string GetEngineIncludes()
        {
            string includes = "";
            try
            {
                includes = ExtractEngineIncludes();
            }
            catch
            {
                Errors.ErrorExit(ErrorCode.DEFINES_AND_INCLUDES_READ_FAILED);
            }

            return ConvertIncludesToQtFormat(includes);
        }

        /// <summary>
        /// Read engine defines from project file (can be implemented with Regex or String operations)
        /// </summary>
        /// <returns>Defines in original format</returns>
        protected abstract string ExtractEngineDefines();

        /// <summary>
        /// Converts defines to Qt format
        /// </summary>
        /// <param name="defines">Defines in original format</param>
        /// <returns>Defines in Qt format</returns>
        protected abstract string ConvertDefinesToQtFormat(string defines);

        /// <summary>
        /// Read engine includes from project file (can be implemented with Regex or String operations)
        /// </summary>
        /// <returns>Includes in original format</returns>
        protected abstract string ExtractEngineIncludes();

        /// <summary>
        /// Converts includes to Qt format
        /// </summary>
        /// <param name="includes">Includes in original format</param>
        /// <returns>Includes in Qt format</returns>
        protected abstract string ConvertIncludesToQtFormat(string includes);

        /// <summary>
        /// Retrieve engine path from project file
        /// </summary>
        /// <returns></returns>
        public string GetEnginePath()
        {
            var match = Regex.Match(projectFileContent, GetUnrealPathRegexPattern());

            if (!match.Success || match.Groups["path"] == null)
                Errors.ErrorExit(ErrorCode.ENGINE_PATH_NOT_FOUND_IN_PROJECT_FILE);

            string path = match.Groups["path"].Value;

            if (!File.Exists(path + @"\Engine\Build\BatchFiles\build.bat"))
                Errors.ErrorExit(ErrorCode.INVALID_ENGINE_PATH_FOUND);

            path = path.Replace("\\", "/");

            return path;
        }

        /// <summary>
        /// Is the engine build which is associated with this project a launcher build?
        /// </summary>
        /// <returns>True if launcher build, false if git build</returns>
        public bool IsLauncherBuild()
        {
            return projectFileContent.Contains("-rocket");
        }

        /// <summary>
        /// Stores a regex which matches the Unreal Engine path in the project file.
        /// IMPORTANT: The part of the matching pattern which contains the actual string needs to be in the matching group "path"
        /// </summary>
        /// <returns>Unreal Engine path pattern</returns>
        protected abstract string GetUnrealPathRegexPattern();
    }
}


text:
package com.cbooy.cakes.patterns.facade;

/**
 * 门面模式测试类
 *
 * @author haoc
 */
public class App {

  public static void main(String[] args) {
    Facade.of().doSocketOpen();
    Facade.of().doSocketClose();
    Facade.of().doFileOpen();
    Facade.of().doFileClose();
  }
}


text:
<?xml version="1.0"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <groupId>com.google.testapp</groupId>
  <artifactId>testapp</artifactId>
  <packaging>jar</packaging>
  <version>1.0-SNAPSHOT</version>
  <name>testapp</name>
  <url>http://maven.apache.org</url>
  <dependencies>
    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <version>3.8.1</version>
      <scope>test</scope>
    </dependency>
  </dependencies>
  <build>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-compiler-plugin</artifactId>
        <version>3.7.0</version>
        <configuration>
          <!-- Note we don't support java < 1.7, so this should blow up. -->
          <source>1.7</source>
          <target>1.6</target>
        </configuration>
      </plugin>
    </plugins>
  </build>
</project>


text:
Website which shows lunch menus of your favorite restaurants

[https://andel-lunch.herokuapp.com/](https://andel-lunch.herokuapp.com/)

## how to run

```bash
$ virtualenv venv
$ source venv/bin/activate
$ pip install -r requirements.txt
$ # python app.py
$ gunicorn app:app --log-file=-
```

Now go to [http://127.0.0.1:8000/](http://127.0.0.1:8000/)


text:
using ::testing::Return;

namespace cobalt {
namespace bindings {
namespace testing {

namespace {
typedef BindingsTestBase ConstantsBindingsTest;
}  // namespace

TEST_F(ConstantsBindingsTest, DefinedOnConstructor) {
  std::string result;
  EXPECT_TRUE(
      EvaluateScript("ConstantsInterface.INTEGER_CONSTANT == 5;", &result));
  EXPECT_STREQ("true", result.c_str());

  EXPECT_TRUE(
      EvaluateScript("ConstantsInterface.DOUBLE_CONSTANT == 2.718;", &result));
  EXPECT_STREQ("true", result.c_str());
}

TEST_F(ConstantsBindingsTest, DefinedOnPrototype) {
  std::string result;
  EXPECT_TRUE(EvaluateScript(
      "ConstantsInterface.prototype.INTEGER_CONSTANT == 5;", &result));
  EXPECT_STREQ("true", result.c_str());

  EXPECT_TRUE(EvaluateScript(
      "ConstantsInterface.prototype.DOUBLE_CONSTANT == 2.718;", &result));
  EXPECT_STREQ("true", result.c_str());
}

TEST_F(ConstantsBindingsTest, ReadOnly) {
  std::string result;
  EXPECT_TRUE(
      EvaluateScript("ConstantsInterface.INTEGER_CONSTANT = 1000;", &result));
  EXPECT_TRUE(
      EvaluateScript("ConstantsInterface.INTEGER_CONSTANT == 5;", &result));
  EXPECT_STREQ("true", result.c_str());

  EXPECT_TRUE(
      EvaluateScript("ConstantsInterface.DOUBLE_CONSTANT = 3.14;", &result));
  EXPECT_TRUE(
      EvaluateScript("ConstantsInterface.DOUBLE_CONSTANT == 2.718;", &result));
  EXPECT_STREQ("true", result.c_str());

  EXPECT_TRUE(EvaluateScript(
      "ConstantsInterface.prototype.INTEGER_CONSTANT = 1000;", &result));
  EXPECT_TRUE(EvaluateScript(
      "ConstantsInterface.prototype.INTEGER_CONSTANT == 5;", &result));
  EXPECT_STREQ("true", result.c_str());

  EXPECT_TRUE(EvaluateScript(
      "ConstantsInterface.prototype.DOUBLE_CONSTANT = 3.14;", &result));
  EXPECT_TRUE(EvaluateScript(
      "ConstantsInterface.prototype.DOUBLE_CONSTANT == 2.718;", &result));
  EXPECT_STREQ("true", result.c_str());
}

}  // namespace testing
}  // namespace bindings
}  // namespace cobalt


text:
'use strict'

const PhotoSize = require('./PhotoSize')

/**
 * This object represents a video file.
 */

class Video {
   /**
    *
    * @param {string} fileId
    * @param {number} width
    * @param {number} height
    * @param {number} duration
    * @param {PhotoSize|null} [thumb]
    * @param {string|null} [mimeType]
    * @param {number|null} [fileSize]
   */
   constructor(
     fileId,
     width,
     height,
     duration,
     thumb,
     mimeType,
     fileSize
   ) {
       this._fileId = fileId
       this._width = width
       this._height = height
       this._duration = duration
       this._thumb = thumb
       this._mimeType = mimeType
       this._fileSize = fileSize
   }

   /**
    * Unique identifier for this file
    * @returns {string}
   */
   get fileId() {
       return this._fileId
   }

   /**
    * Video width as defined by sender
    * @returns {number}
   */
   get width() {
       return this._width
   }

   /**
    * Video height as defined by sender
    * @returns {number}
   */
   get height() {
       return this._height
   }

   /**
    * Duration of the video in seconds as defined by sender
    * @returns {number}
   */
   get duration() {
       return this._duration
   }

   /**
    * Video thumbnail
    * @returns {PhotoSize|null}
   */
   get thumb() {
       return this._thumb
   }

   /**
    * Mime type of a file as defined by sender
    * @returns {string|null}
   */
   get mimeType() {
       return this._mimeType
   }

   /**
    * File size
    * @returns {number|null}
   */
   get fileSize() {
       return this._fileSize
   }

   /**
    *
    * @param {Object} raw
    * @returns {Video}
    */
   static deserialize(raw) {
      return new Video(
          raw['file_id'],
          raw['width'],
          raw['height'],
          raw['duration'],
          raw['thumb'] ? PhotoSize.deserialize(raw['thumb']) : null,
          raw['mime_type'] ? raw['mime_type'] : null,
          raw['file_size'] ? raw['file_size'] : null
      )
   }

   /**
    *
    * @returns {Object}
    */
   serialize() {
      return {
          file_id: this.fileId ? this.fileId : undefined,
          width: this.width ? this.width : undefined,
          height: this.height ? this.height : undefined,
          duration: this.duration ? this.duration : undefined,
          thumb: this.thumb ? this.thumb.serialize() : undefined,
          mime_type: this.mimeType ? this.mimeType : undefined,
          file_size: this.fileSize ? this.fileSize : undefined
      }
   }

   /**
    *
    * @returns {string}
    */
   toJSON() {
      return this.serialize()
   }
}

module.exports = Video