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

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

Introduction

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

Prototype

CaseFormat LOWER_CAMEL

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

Click Source Link

Document

Java variable naming convention, e.g., "lowerCamel".

Usage

From source file:com.axelor.rpc.filter.Operator.java

private Operator(String value) {
    this.value = value;
    this.id = CaseFormat.UPPER_UNDERSCORE.to(CaseFormat.LOWER_CAMEL, this.name());
}

From source file:com.netflix.spinnaker.clouddriver.lambda.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;
    }//  www  .  jav  a2s  . com

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

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

    switch (namespace) {
    case LAMBDA_FUNCTIONS:
        result.put("region", parts[3]);
        result.put("AwsLambdaName", parts[4]);
        break;
    case IAM_ROLE:
        result.put("roleName", parts[3]);
        break;
    default:
        break;
    }

    return result;
}

From source file:org.glowroot.local.ui.QueryStrings.java

static <T> T decode(String queryString, Class<T> clazz) throws Exception {
    Method builderMethod = Reflections.getDeclaredMethod(clazz, "builder");
    Object builder = Reflections.invokeStatic(builderMethod);
    checkNotNull(builder);/*from   w ww.  j  a va 2  s  . c  om*/
    Class<?> immutableBuilderClass = builder.getClass();
    Map<String, Method> setters = settersCache.getUnchecked(immutableBuilderClass);
    QueryStringDecoder decoder = new QueryStringDecoder('?' + queryString);
    for (Entry<String, List<String>> entry : decoder.parameters().entrySet()) {
        String key = entry.getKey();
        key = CaseFormat.LOWER_HYPHEN.to(CaseFormat.LOWER_CAMEL, key);
        // special rule for "-mbean" so that it will convert to "...MBean"
        key = key.replace("Mbean", "MBean");
        Method setter = setters.get(key);
        checkNotNull(setter, "Unexpected attribute: %s", key);
        Class<?> valueClass = setter.getParameterTypes()[0];
        Object value;
        if (valueClass == Iterable.class) {
            // only lists of type string supported
            value = entry.getValue();
        } else {
            value = parseString(entry.getValue().get(0), valueClass);
        }
        Reflections.invoke(setter, builder, value);
    }
    Method build = Reflections.getDeclaredMethod(immutableBuilderClass, "build");
    @SuppressWarnings("unchecked")
    T decoded = (T) Reflections.invoke(build, builder);
    return decoded;
}

From source file:com.querydsl.core.types.dsl.PathBuilderFactory.java

/**
 * Create a new PathBuilder instance for the given type
 *
 * @param type type of expression//www. java  2 s  .  c  o  m
 * @return new PathBuilder instance
 */
@SuppressWarnings("unchecked")
public <T> PathBuilder<T> create(Class<T> type) {
    PathBuilder<T> rv = (PathBuilder<T>) paths.get(type);
    if (rv == null) {
        rv = new PathBuilder<T>(type, CaseFormat.UPPER_CAMEL.to(CaseFormat.LOWER_CAMEL, type.getSimpleName()));
        paths.put(type, rv);
    }
    return rv;
}

From source file:fr.putnami.pwt.core.widget.client.helper.EnumRenderer.java

public String getEnumKey(E value) {
    if (value == null) {
        return null;
    }/*from  w ww . ja v a  2 s  . c o m*/
    StringBuilder result = new StringBuilder();
    result.append(CaseFormat.UPPER_CAMEL.to(CaseFormat.LOWER_CAMEL, this.getSimpleClassName(value)));
    result.append(CaseFormat.UPPER_UNDERSCORE.to(CaseFormat.UPPER_CAMEL, value.toString()));
    result.append(EnumRenderer.ENUM_SUFFIX);
    return result.toString();
}

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

public static String lowerCamelToUpperCamel(String name) {
    return CaseFormat.LOWER_CAMEL.to(CaseFormat.UPPER_CAMEL, name);
}

From source file:com.github.steveash.spring.WiringFactoryBeanFactoryPostProcessor.java

@Nullable
static java.lang.String getPrototypeBeanNameFromBeanClass(Class<?> prototypeBeanClass) {
    String prototypeBeanName = prototypeBeanClass.getSimpleName();
    return CaseFormat.UPPER_CAMEL.to(CaseFormat.LOWER_CAMEL, prototypeBeanName);
}

From source file:org.ow2.proactive.scheduling.api.graphql.common.InputFields.java

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

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

public static String camelToUnderscore(final String str) {
    return CaseFormat.LOWER_CAMEL.to(CaseFormat.LOWER_UNDERSCORE, str);
}

From source file:google.registry.model.transfer.TransferStatus.java

public String getXmlName() {
    return CaseFormat.UPPER_UNDERSCORE.to(CaseFormat.LOWER_CAMEL, toString());
}