com.amazonaws.util.StringUtils.upperCase()方法的使用及代码示例

x33g5p2x  于2022-01-30 转载在 其他  
字(10.2k)|赞(0)|评价(0)|浏览(113)

本文整理了Java中com.amazonaws.util.StringUtils.upperCase()方法的一些代码示例,展示了StringUtils.upperCase()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。StringUtils.upperCase()方法的具体详情如下:
包路径:com.amazonaws.util.StringUtils
类名称:StringUtils
方法名:upperCase

StringUtils.upperCase介绍

[英]Converts a given String to upper case with Locale.ENGLISH
[中]将给定字符串转换为带区域设置的大写字母。英语

代码示例

代码示例来源:origin: aws/aws-sdk-java

public static String capitialize(String name) {
  if (name == null || name.trim().isEmpty()) {
    throw new IllegalArgumentException("Name cannot be null or empty");
  }
  return name.length() < 2 ? StringUtils.upperCase(name) : StringUtils.upperCase(name.substring(0, 1))
      + name.substring(1);
}

代码示例来源:origin: aws/aws-sdk-java

@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();
}

代码示例来源:origin: aws/aws-sdk-java

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;
    }
  }
}

代码示例来源:origin: aws/aws-sdk-java

/**
 * @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);
}

代码示例来源:origin: aws/aws-sdk-java

if (requestRegion != null && !StringUtils.upperCase(requestRegion).equals(Region.US_Standard.toString())) {
  XmlWriter xml = new XmlWriter();
  xml.start("CreateBucketConfiguration", "xmlns", Constants.XML_NAMESPACE);

代码示例来源:origin: aws-amplify/aws-sdk-android

/**
 * 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;
}

代码示例来源:origin: aws-amplify/aws-sdk-android

/**
 * 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;
}

代码示例来源:origin: com.amazonaws/aws-java-sdk-core

/**
 * @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);
}

代码示例来源:origin: aws-amplify/aws-sdk-android

@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);
}

代码示例来源:origin: aws-amplify/aws-sdk-android

@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;
}

代码示例来源:origin: aws-amplify/aws-sdk-android

if (region != null && !StringUtils.upperCase(region).equals(Region.US_Standard.toString())) {
  final XmlWriter xml = new XmlWriter();
  xml.start("CreateBucketConfiguration", "xmlns", Constants.XML_NAMESPACE);

代码示例来源:origin: com.amazonaws/aws-android-sdk-core

/**
 * 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;
}

代码示例来源:origin: com.gluonhq/aws-java-sdk-core

/**
 * 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;
}

代码示例来源:origin: com.amazonaws/aws-java-sdk-code-generator

public static String capitialize(String name) {
  if (name == null || name.trim().isEmpty()) {
    throw new IllegalArgumentException("Name cannot be null or empty");
  }
  return name.length() < 2 ? StringUtils.upperCase(name) : StringUtils.upperCase(name.substring(0, 1))
      + name.substring(1);
}

代码示例来源:origin: com.amazonaws/aws-java-sdk-code-generator

@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();
}

代码示例来源:origin: com.gluonhq/aws-java-sdk-core

/**
 * 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;
}

代码示例来源:origin: com.amazonaws/aws-android-sdk-core

/**
 * 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;
}

代码示例来源:origin: com.amazonaws/aws-java-sdk-code-generator

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;
    }
  }
}

代码示例来源:origin: Nextdoor/bender

/**
 * @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);
}

代码示例来源:origin: Nextdoor/bender

if (requestRegion != null && !StringUtils.upperCase(requestRegion).equals(Region.US_Standard.toString())) {
  XmlWriter xml = new XmlWriter();
  xml.start("CreateBucketConfiguration", "xmlns", Constants.XML_NAMESPACE);

相关文章