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 software.amazon.awssdk.codegen.internal.TypeUtils;
19 
20 public class ListModel {
21 
22     private String implType;
23 
24     private String memberType;
25 
26     private String interfaceType;
27 
28     private MemberModel listMemberModel;
29 
30     private String memberLocationName;
31 
32     private String memberAdditionalMarshallingPath;
33 
34     private String memberAdditionalUnmarshallingPath;
35 
ListModel()36     public ListModel() {
37     }
38 
ListModel(String memberType, String memberLocationName, String implType, String interfaceType, MemberModel listMemberModel)39     public ListModel(String memberType,
40                      String memberLocationName,
41                      String implType,
42                      String interfaceType,
43                      MemberModel listMemberModel) {
44 
45         this.memberType = memberType;
46         this.memberLocationName = memberLocationName;
47         this.implType = implType;
48         this.interfaceType = interfaceType;
49         this.listMemberModel = listMemberModel;
50     }
51 
getImplType()52     public String getImplType() {
53         return implType;
54     }
55 
setImplType(String implType)56     public void setImplType(String implType) {
57         this.implType = implType;
58     }
59 
getMemberType()60     public String getMemberType() {
61         return memberType;
62     }
63 
setMemberType(String memberType)64     public void setMemberType(String memberType) {
65         this.memberType = memberType;
66     }
67 
getInterfaceType()68     public String getInterfaceType() {
69         return interfaceType;
70     }
71 
setInterfaceType(String interfaceType)72     public void setInterfaceType(String interfaceType) {
73         this.interfaceType = interfaceType;
74     }
75 
getListMemberModel()76     public MemberModel getListMemberModel() {
77         return listMemberModel;
78     }
79 
setListMemberModel(MemberModel listMemberModel)80     public void setListMemberModel(MemberModel listMemberModel) {
81         this.listMemberModel = listMemberModel;
82     }
83 
getMemberLocationName()84     public String getMemberLocationName() {
85         return memberLocationName;
86     }
87 
setMemberLocationName(String memberLocationName)88     public void setMemberLocationName(String memberLocationName) {
89         this.memberLocationName = memberLocationName;
90     }
91 
getMemberAdditionalMarshallingPath()92     public String getMemberAdditionalMarshallingPath() {
93         return memberAdditionalMarshallingPath;
94     }
95 
setMemberAdditionalMarshallingPath( String memberAdditionalMarshallingPath)96     public void setMemberAdditionalMarshallingPath(
97             String memberAdditionalMarshallingPath) {
98         this.memberAdditionalMarshallingPath = memberAdditionalMarshallingPath;
99     }
100 
getMemberAdditionalUnmarshallingPath()101     public String getMemberAdditionalUnmarshallingPath() {
102         return memberAdditionalUnmarshallingPath;
103     }
104 
setMemberAdditionalUnmarshallingPath( String memberAdditionalUnmarshallingPath)105     public void setMemberAdditionalUnmarshallingPath(
106             String memberAdditionalUnmarshallingPath) {
107         this.memberAdditionalUnmarshallingPath = memberAdditionalUnmarshallingPath;
108     }
109 
isSimple()110     public boolean isSimple() {
111         return TypeUtils.isSimple(memberType);
112     }
113 
isMap()114     public boolean isMap() {
115         return memberType.startsWith(TypeUtils
116                                              .getDataTypeMapping(TypeUtils.TypeKey.MAP_INTERFACE));
117     }
118 
getTemplateType()119     public String getTemplateType() {
120         return interfaceType + "<" + memberType + ">";
121     }
122 
getTemplateImplType()123     public String getTemplateImplType() {
124         return implType + "<" + memberType + ">";
125     }
126 
getSimpleType()127     public String getSimpleType() {
128         int startIndex = memberType.lastIndexOf('.');
129         return memberType.substring(startIndex + 1);
130     }
131 }
132