@Override public String getEnumValueName(String enumValue) { StringBuilder builder = new StringBuilder(); String sanitizedEnumValue = enumValue.replace("::", ":").replace("/", "").replace("(", "") .replace(")", ""); for (String part : sanitizedEnumValue.split("[ -.:]")) { if (part.length() > 1) { builder.append(StringUtils.upperCase(part.substring(0, 1))) .append(part.substring(1)); } else { builder.append(StringUtils.upperCase(part)); } } return builder.toString(); }
private String deriveMarshallerLocationName(String memberName, Member member, String protocol) { final String queryName = member.getQueryName(); if (queryName != null && !queryName.trim().isEmpty()) { return queryName; } else { final String locationName = member.getLocationName(); if (locationName != null && !locationName.trim().isEmpty()) { if (protocol.equals(Protocol.EC2.getValue())) { return StringUtils.upperCase(locationName.substring(0, 1)) + locationName.substring(1); } return locationName; } else { return memberName; } } }
/** * @param value Raw string representing value of enum * @return HttpMethodName enum or null if value is not present. * @throws IllegalArgumentException If value does not represent a known enum value. */ public static HttpMethodName fromValue(String value) { if (StringUtils.isNullOrEmpty(value)) { return null; } final String upperCaseValue = StringUtils.upperCase(value); for (HttpMethodName httpMethodName : values()) { if (httpMethodName.name().equals(upperCaseValue)) { return httpMethodName; } } throw new IllegalArgumentException("Unsupported HTTP method name " + value); }
if (requestRegion != null && !StringUtils.upperCase(requestRegion).equals(Region.US_Standard.toString())) { XmlWriter xml = new XmlWriter(); xml.start("CreateBucketConfiguration", "xmlns", Constants.XML_NAMESPACE);
/** * Constructs a HttpRequest with given method and uri. * * @param method HTTP method * @param uri uri of the request. * @param headers HTTP headers key-value map * @param content content of the request. Can be null if no content. */ @SuppressWarnings("unchecked") public HttpRequest(String method, URI uri, Map<String, String> headers, InputStream content) { this.method = StringUtils.upperCase(method); this.uri = uri; this.headers = headers == null ? Collections.EMPTY_MAP : Collections.unmodifiableMap(headers); this.content = content; }
/** * Gets value from the error body map. * * @param key key of map * @return null if key is null; "" if not exists */ public String get(String key) { if (key == null || key.length() == 0) { return null; } String firstLetterUppercaseKey; String firstLetterLowercaseKey; firstLetterLowercaseKey = StringUtils.lowerCase(key.substring(0, 1)) + key.substring(1); firstLetterUppercaseKey = StringUtils.upperCase(key.substring(0, 1)) + key.substring(1); String value = ""; if (map.containsKey(firstLetterUppercaseKey)) { value = map.get(firstLetterUppercaseKey); } else if (map.containsKey(firstLetterLowercaseKey)) { value = map.get(firstLetterLowercaseKey); } return value; }
/** * @param value Raw string representing value of enum * @return HttpMethodName enum or null if value is not present. * @throws IllegalArgumentException If value does not represent a known enum value. */ public static HttpMethodName fromValue(String value) { if (StringUtils.isNullOrEmpty(value)) { return null; } final String upperCaseValue = StringUtils.upperCase(value); for (HttpMethodName httpMethodName : values()) { if (httpMethodName.name().equals(upperCaseValue)) { return httpMethodName; } } throw new IllegalArgumentException("Unsupported HTTP method name " + value); }
@Test public void testUpperCase() { assertNull("null", StringUtils.upperCase(null)); assertEquals("empty string", "", StringUtils.upperCase("")); assertEquals("aBc -> ABC", "ABC", StringUtils.upperCase("aBc")); // https://github.com/aws/aws-sdk-android/issues/96 final Locale defaultLocale = Locale.getDefault(); Locale.setDefault(new Locale("tr", "TR")); assertEquals("turkish locale", "X-AMZ-INVOCATION-TYPE", StringUtils.upperCase("X-Amz-Invocation-Type")); Locale.setDefault(defaultLocale); }
@Override public Map<String, AttributeValue> transform(Parameters<?> parameters) { Map<String, AttributeValue> upperCased = new HashMap<String, AttributeValue>(); for (Map.Entry<String, AttributeValue> curr : parameters.getAttributeValues() .entrySet()) { upperCased.put(curr.getKey(), new AttributeValue().withS(StringUtils.upperCase(curr.getValue().getS()))); } return upperCased; }
if (region != null && !StringUtils.upperCase(region).equals(Region.US_Standard.toString())) { final XmlWriter xml = new XmlWriter(); xml.start("CreateBucketConfiguration", "xmlns", Constants.XML_NAMESPACE);
/** * Constructs a HttpRequest with given method and uri. * * @param method HTTP method * @param uri uri of the request. * @param headers HTTP headers key-value map * @param content content of the request. Can be null if no content. */ @SuppressWarnings("unchecked") public HttpRequest(String method, URI uri, Map<String, String> headers, InputStream content) { this.method = StringUtils.upperCase(method); this.uri = uri; this.headers = headers == null ? Collections.EMPTY_MAP : Collections.unmodifiableMap(headers); this.content = content; }
/** * Constructs a HttpRequest with given method and uri. * * @param method HTTP method * @param uri uri of the request. * @param headers HTTP headers key-value map * @param content content of the request. Can be null if no content. */ @SuppressWarnings("unchecked") public HttpRequest(String method, URI uri, Map<String, String> headers, InputStream content) { this.method = StringUtils.upperCase(method); this.uri = uri; this.headers = headers == null ? Collections.EMPTY_MAP : Collections.unmodifiableMap(headers); this.content = content; }
@Override public String getEnumValueName(String enumValue) { StringBuilder builder = new StringBuilder(); String sanitizedEnumValue = enumValue.replace("::", ":").replace("/", "").replace("(", "") .replace(")", ""); for (String part : sanitizedEnumValue.split("[ -.:]")) { if (part.length() > 1) { builder.append(StringUtils.upperCase(part.substring(0, 1))) .append(part.substring(1)); } else { builder.append(StringUtils.upperCase(part)); } } return builder.toString(); }
/** * Gets value from the error body map. * * @param key key of map * @return null if key is null; "" if not exists */ public String get(String key) { if (key == null || key.length() == 0) { return null; } String firstLetterUppercaseKey; String firstLetterLowercaseKey; firstLetterLowercaseKey = StringUtils.lowerCase(key.substring(0, 1)) + key.substring(1); firstLetterUppercaseKey = StringUtils.upperCase(key.substring(0, 1)) + key.substring(1); String value = ""; if (map.containsKey(firstLetterUppercaseKey)) { value = map.get(firstLetterUppercaseKey); } else if (map.containsKey(firstLetterLowercaseKey)) { value = map.get(firstLetterLowercaseKey); } return value; }
/** * Gets value from the error body map. * * @param key key of map * @return null if key is null; "" if not exists */ public String get(String key) { if (key == null || key.length() == 0) { return null; } String firstLetterUppercaseKey; String firstLetterLowercaseKey; firstLetterLowercaseKey = StringUtils.lowerCase(key.substring(0, 1)) + key.substring(1); firstLetterUppercaseKey = StringUtils.upperCase(key.substring(0, 1)) + key.substring(1); String value = ""; if (map.containsKey(firstLetterUppercaseKey)) { value = map.get(firstLetterUppercaseKey); } else if (map.containsKey(firstLetterLowercaseKey)) { value = map.get(firstLetterLowercaseKey); } return value; }
private String deriveMarshallerLocationName(String memberName, Member member, String protocol) { final String queryName = member.getQueryName(); if (queryName != null && !queryName.trim().isEmpty()) { return queryName; } else { final String locationName = member.getLocationName(); if (locationName != null && !locationName.trim().isEmpty()) { if (protocol.equals(Protocol.EC2.getValue())) { return StringUtils.upperCase(locationName.substring(0, 1)) + locationName.substring(1); } return locationName; } else { return memberName; } } }
/** * @param value Raw string representing value of enum * @return HttpMethodName enum or null if value is not present. * @throws IllegalArgumentException If value does not represent a known enum value. */ public static HttpMethodName fromValue(String value) { if (StringUtils.isNullOrEmpty(value)) { return null; } final String upperCaseValue = StringUtils.upperCase(value); for (HttpMethodName httpMethodName : values()) { if (httpMethodName.name().equals(upperCaseValue)) { return httpMethodName; } } throw new IllegalArgumentException("Unsupported HTTP method name " + value); }
if (requestRegion != null && !StringUtils.upperCase(requestRegion).equals(Region.US_Standard.toString())) { XmlWriter xml = new XmlWriter(); xml.start("CreateBucketConfiguration", "xmlns", Constants.XML_NAMESPACE);