• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License").
5  * You may not use this file except in compliance with the License.
6  * A copy of the License is located at
7  *
8  *  http://aws.amazon.com/apache2.0
9  *
10  * or in the "license" file accompanying this file. This file is distributed
11  * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
12  * express or implied. See the License for the specific language governing
13  * permissions and limitations under the License.
14  */
15 
16 package software.amazon.awssdk.codegen.model.intermediate;
17 
18 import java.util.Iterator;
19 import java.util.List;
20 import software.amazon.awssdk.codegen.internal.Utils;
21 
22 public class SimpleMethodFormModel {
23 
24     private List<ArgumentModel> arguments;
25 
getArguments()26     public List<ArgumentModel> getArguments() {
27         return arguments;
28     }
29 
setArguments(List<ArgumentModel> arguments)30     public void setArguments(List<ArgumentModel> arguments) {
31         this.arguments = arguments;
32     }
33 
getArgumentsDeclaration()34     public String getArgumentsDeclaration() {
35         StringBuilder builder = new StringBuilder();
36 
37         Iterator<ArgumentModel> iter = arguments.iterator();
38         while (iter.hasNext()) {
39             ArgumentModel arg = iter.next();
40 
41             builder.append(arg.getType())
42                    .append(" ")
43                    .append(arg.getName());
44 
45             if (iter.hasNext()) {
46                 builder.append(", ");
47             }
48         }
49 
50         return builder.toString();
51     }
52 
getWithMethodCalls()53     public String getWithMethodCalls() {
54         StringBuilder builder = new StringBuilder();
55 
56         for (ArgumentModel arg : arguments) {
57             builder.append(".with")
58                    .append(Utils.capitalize(arg.getName()))
59                    .append("(")
60                    .append(arg.getName())
61                    .append(")");
62         }
63 
64         return builder.toString();
65     }
66 }
67