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.model.service.Location; 19 import software.amazon.awssdk.core.protocol.MarshallLocation; 20 21 public class ParameterHttpMapping { 22 23 private String unmarshallLocationName; 24 private String marshallLocationName; 25 26 private String additionalUnmarshallingPath; 27 private String additionalMarshallingPath; 28 29 private boolean isPayload; 30 private boolean isStreaming; 31 private Location location; 32 private boolean flattened; 33 private boolean isGreedy; 34 private boolean requiresLength; 35 getIsPayload()36 public boolean getIsPayload() { 37 return isPayload; 38 } 39 setPayload(boolean isPayload)40 public void setPayload(boolean isPayload) { 41 this.isPayload = isPayload; 42 } 43 withPayload(boolean isPayload)44 public ParameterHttpMapping withPayload(boolean isPayload) { 45 this.isPayload = isPayload; 46 return this; 47 } 48 getIsStreaming()49 public boolean getIsStreaming() { 50 return isStreaming; 51 } 52 setStreaming(boolean isStreaming)53 public void setStreaming(boolean isStreaming) { 54 this.isStreaming = isStreaming; 55 } 56 withStreaming(boolean isStreaming)57 public ParameterHttpMapping withStreaming(boolean isStreaming) { 58 this.isStreaming = isStreaming; 59 return this; 60 } 61 getLocation()62 public Location getLocation() { 63 return location; 64 } 65 setLocation(Location location)66 public void setLocation(Location location) { 67 this.location = location; 68 } 69 withLocation(Location location)70 public ParameterHttpMapping withLocation(Location location) { 71 this.location = location; 72 return this; 73 } 74 isHeader()75 public boolean isHeader() { 76 return this.location == Location.HEADER; 77 } 78 isUri()79 public boolean isUri() { 80 return this.location == Location.URI; 81 } 82 isStatusCode()83 public boolean isStatusCode() { 84 return this.location == Location.STATUS_CODE; 85 } 86 isQueryString()87 public boolean isQueryString() { 88 return this.location == Location.QUERY_STRING; 89 } 90 isFlattened()91 public boolean isFlattened() { 92 return flattened; 93 } 94 setFlattened(boolean flattened)95 public void setFlattened(boolean flattened) { 96 this.flattened = flattened; 97 } 98 withFlattened(boolean flattened)99 public ParameterHttpMapping withFlattened(boolean flattened) { 100 this.flattened = flattened; 101 return this; 102 } 103 getUnmarshallLocationName()104 public String getUnmarshallLocationName() { 105 return unmarshallLocationName; 106 } 107 setUnmarshallLocationName(String unmarshallLocationName)108 public void setUnmarshallLocationName(String unmarshallLocationName) { 109 this.unmarshallLocationName = unmarshallLocationName; 110 } 111 withUnmarshallLocationName(String unmarshallLocationName)112 public ParameterHttpMapping withUnmarshallLocationName(String unmarshallLocationName) { 113 this.unmarshallLocationName = unmarshallLocationName; 114 return this; 115 } 116 getMarshallLocationName()117 public String getMarshallLocationName() { 118 return marshallLocationName; 119 } 120 setMarshallLocationName(String marshallLocationName)121 public void setMarshallLocationName(String marshallLocationName) { 122 this.marshallLocationName = marshallLocationName; 123 } 124 withMarshallLocationName(String marshallLocationName)125 public ParameterHttpMapping withMarshallLocationName(String marshallLocationName) { 126 this.marshallLocationName = marshallLocationName; 127 return this; 128 } 129 getAdditionalUnmarshallingPath()130 public String getAdditionalUnmarshallingPath() { 131 return additionalUnmarshallingPath; 132 } 133 setAdditionalUnmarshallingPath(String additionalUnmarshallingPath)134 public void setAdditionalUnmarshallingPath(String additionalUnmarshallingPath) { 135 this.additionalUnmarshallingPath = additionalUnmarshallingPath; 136 } 137 withAdditionalUnmarshallingPath(String additionalUnmarshallingPath)138 public ParameterHttpMapping withAdditionalUnmarshallingPath(String additionalUnmarshallingPath) { 139 this.additionalUnmarshallingPath = additionalUnmarshallingPath; 140 return this; 141 } 142 getAdditionalMarshallingPath()143 public String getAdditionalMarshallingPath() { 144 return additionalMarshallingPath; 145 } 146 setAdditionalMarshallingPath(String additionalMarshallingPath)147 public void setAdditionalMarshallingPath(String additionalMarshallingPath) { 148 this.additionalMarshallingPath = additionalMarshallingPath; 149 } 150 withAdditionalMarshallingPath(String additionalMarshallingPath)151 public ParameterHttpMapping withAdditionalMarshallingPath(String additionalMarshallingPath) { 152 this.additionalMarshallingPath = additionalMarshallingPath; 153 return this; 154 } 155 isGreedy()156 public boolean isGreedy() { 157 return isGreedy; 158 } 159 setIsGreedy(boolean greedy)160 public ParameterHttpMapping setIsGreedy(boolean greedy) { 161 isGreedy = greedy; 162 return this; 163 } 164 withIsGreedy(boolean greedy)165 public ParameterHttpMapping withIsGreedy(boolean greedy) { 166 setIsGreedy(greedy); 167 return this; 168 } 169 isRequiresLength()170 public boolean isRequiresLength() { 171 return requiresLength; 172 } 173 setRequiresLength(boolean requiresLength)174 public void setRequiresLength(boolean requiresLength) { 175 this.requiresLength = requiresLength; 176 } 177 withRequiresLength(boolean requiresLength)178 public ParameterHttpMapping withRequiresLength(boolean requiresLength) { 179 setRequiresLength(requiresLength); 180 return this; 181 } 182 getMarshallLocation()183 public MarshallLocation getMarshallLocation() { 184 if (location == null) { 185 return MarshallLocation.PAYLOAD; 186 } 187 switch (location) { 188 default: 189 return MarshallLocation.PAYLOAD; 190 case STATUS_CODE: 191 return MarshallLocation.STATUS_CODE; 192 case HEADER: 193 case HEADERS: 194 return MarshallLocation.HEADER; 195 case QUERY_STRING: 196 return MarshallLocation.QUERY_PARAM; 197 case URI: 198 return isGreedy ? MarshallLocation.GREEDY_PATH : MarshallLocation.PATH; 199 } 200 } 201 202 } 203