Java tutorial
/* * ****************************************************************************** * Copyright 2014-2015 Spectra Logic Corporation. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"). You may not use * this file except in compliance with the License. A copy of the License is located at * * http://www.apache.org/licenses/LICENSE-2.0 * * or in the "license" file accompanying this file. * This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR * CONDITIONS OF ANY KIND, either express or implied. See the License for the * specific language governing permissions and limitations under the License. * **************************************************************************** */ package com.spectralogic.ds3autogen.java.generators.requestmodels; import com.google.common.collect.ImmutableList; import com.spectralogic.ds3autogen.api.models.Arguments; import com.spectralogic.ds3autogen.api.models.apispec.Ds3Request; import static com.spectralogic.ds3autogen.utils.Helper.removeVoidArguments; import static com.spectralogic.ds3autogen.utils.RequestConverterUtil.getRequiredArgsFromRequestHeader; /** * Special cases a request to have a required request payload of CompleteMultipartUpload. * Requests that use this generator should also use the associated template file of * complete_multipart_upload_template.ftl */ public class CompleteMultipartUploadRequestGenerator extends BaseRequestGenerator { /** * Gets the list of Arguments needed to create the request constructor. This * includes all non-void required parameters, and arguments described within * the request header. This includes a request payload of type CompleteMultipartUpload. */ @Override public ImmutableList<Arguments> toConstructorArgumentsList(final Ds3Request ds3Request) { final ImmutableList.Builder<Arguments> builder = ImmutableList.builder(); builder.addAll(getRequiredArgsFromRequestHeader(ds3Request)); builder.addAll(removeVoidArguments(toArgumentsList(ds3Request.getRequiredQueryParams()))); builder.add(new Arguments("CompleteMultipartUpload", "RequestPayload")); return builder.build(); } }