Example usage for com.google.common.base CaseFormat UPPER_UNDERSCORE

List of usage examples for com.google.common.base CaseFormat UPPER_UNDERSCORE

Introduction

In this page you can find the example usage for com.google.common.base CaseFormat UPPER_UNDERSCORE.

Prototype

CaseFormat UPPER_UNDERSCORE

To view the source code for com.google.common.base CaseFormat UPPER_UNDERSCORE.

Click Source Link

Document

Java and C++ constant naming convention, e.g., "UPPER_UNDERSCORE".

Usage

From source file:com.facebook.buck.cxx.toolchain.HeaderMode.java

HeaderMode() {
    this.flavor = InternalFlavor.of(String.format("%s-%s",
            CaseFormat.UPPER_CAMEL.to(CaseFormat.LOWER_HYPHEN, getClass().getSimpleName()),
            CaseFormat.UPPER_UNDERSCORE.to(CaseFormat.LOWER_HYPHEN, toString())));
}

From source file:com.opengamma.strata.finance.rate.swap.CompoundingMethod.java

/**
 * Obtains the type from a unique name./*w w w .  j  a  v  a2s.  c  om*/
 * 
 * @param uniqueName  the unique name
 * @return the type
 * @throws IllegalArgumentException if the name is not known
 */
@FromString
public static CompoundingMethod of(String uniqueName) {
    ArgChecker.notNull(uniqueName, "uniqueName");
    return valueOf(CaseFormat.UPPER_CAMEL.to(CaseFormat.UPPER_UNDERSCORE, uniqueName));
}

From source file:com.github.ko2ic.plugin.eclipse.taggen.common.domain.valueobject.NameRuleString.java

public String phraseConstantName() {
    String value = str;// ww w. j a va2 s . c o m
    if (Character.isUpperCase(str.charAt(0))) {
        if (!str.contains("_")) {
            value = CaseFormat.UPPER_CAMEL.to(CaseFormat.UPPER_UNDERSCORE, str);
        }
    } else {
        if (str.contains("_")) {
            value = CaseFormat.LOWER_UNDERSCORE.to(CaseFormat.UPPER_UNDERSCORE, str);
        } else {
            value = CaseFormat.LOWER_CAMEL.to(CaseFormat.UPPER_UNDERSCORE, str);
        }
    }
    return value;
}

From source file:com.spectralogic.ds3autogen.utils.Helper.java

public static String underscoreToCamel(final String str) {
    return CaseFormat.UPPER_UNDERSCORE.to(CaseFormat.UPPER_CAMEL, str);
}

From source file:com.netflix.spinnaker.clouddriver.ecs.cache.Keys.java

public static Map<String, String> parse(String key) {
    String[] parts = key.split(SEPARATOR);

    if (parts.length < 3 || !parts[0].equals(ID)) {
        return null;
    }//from   w  ww  .j  a v a 2 s .c  om

    Map<String, String> result = new HashMap<>();
    result.put("provider", parts[0]);
    result.put("type", parts[1]);
    result.put("account", parts[2]);

    if (!canParse(parts[1]) && parts[1].equals(HEALTH.getNs())) {
        result.put("region", parts[3]);
        result.put("taskId", parts[4]);
        return result;
    }

    Namespace namespace = Namespace.valueOf(CaseFormat.LOWER_CAMEL.to(CaseFormat.UPPER_UNDERSCORE, parts[1]));

    if (!namespace.equals(Namespace.IAM_ROLE)) {
        result.put("region", parts[3]);
    }

    switch (namespace) {
    case SERVICES:
        result.put("serviceName", parts[4]);
        break;
    case ECS_CLUSTERS:
        result.put("clusterName", parts[4]);
        break;
    case TASKS:
        result.put("taskId", parts[4]);
        break;
    case CONTAINER_INSTANCES:
        result.put("containerInstanceArn", parts[4]);
        break;
    case TASK_DEFINITIONS:
        result.put("taskDefinitionArn", parts[4]);
        break;
    case ALARMS:
        result.put("alarmArn", parts[4]);
        break;
    case IAM_ROLE:
        result.put("roleName", parts[3]);
        break;
    case SCALABLE_TARGETS:
        result.put("resource", parts[4]);
        break;
    default:
        break;
    }

    return result;
}

From source file:org.jclouds.vcloud.domain.network.FenceMode.java

public String value() {
    return CaseFormat.UPPER_UNDERSCORE.to(CaseFormat.LOWER_CAMEL, name());
}

From source file:org.jclouds.aws.ec2.domain.InstanceState.java

public String value() {
    return (CaseFormat.UPPER_UNDERSCORE.to(CaseFormat.LOWER_HYPHEN, name()));
}

From source file:com.google.api.codegen.LanguageUtil.java

public static String lowerCamelToUpperUnderscore(String name) {
    return CaseFormat.LOWER_CAMEL.to(CaseFormat.UPPER_UNDERSCORE, name);
}

From source file:com.contentful.vault.compiler.FieldsInjection.java

private FieldSpec createFieldSpec(FieldMeta field) {
    String name = CaseFormat.LOWER_CAMEL.converterTo(CaseFormat.UPPER_UNDERSCORE).convert(field.name());
    if (name == null) {
        throw new IllegalArgumentException("Invalid field with ID '" + field.id() + "' for generated class '"
                + className.simpleName() + "', has no name.");
    }//  w  ww  .j a va  2s.  c o  m
    return FieldSpec.builder(String.class, name, Modifier.PUBLIC, Modifier.STATIC, Modifier.FINAL)
            .initializer("$S", field.name()).build();
}

From source file:org.jclouds.joyent.cloudapi.v6_5.reference.Metadata.java

public String key() {
    return CaseFormat.UPPER_UNDERSCORE.to(CaseFormat.LOWER_UNDERSCORE, name());
}