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

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

Introduction

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

Prototype

CaseFormat LOWER_UNDERSCORE

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

Click Source Link

Document

C++ variable naming convention, e.g., "lower_underscore".

Usage

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

public String phraseVariableName() {
    String value = str;//from  w w  w .ja  v  a 2s .  co  m
    if (Character.isUpperCase(str.charAt(0))) {
        if (str.contains("_")) {
            value = CaseFormat.UPPER_UNDERSCORE.to(CaseFormat.LOWER_CAMEL, str);
        } else {
            value = CaseFormat.UPPER_CAMEL.to(CaseFormat.LOWER_CAMEL, str);
        }
    } else {
        if (str.contains("_")) {
            value = CaseFormat.LOWER_UNDERSCORE.to(CaseFormat.LOWER_CAMEL, str);
        }
    }
    return value;
}

From source file:datamine.storage.idl.generator.metadata.MetadataFileGenerator.java

public static String getEnumValue(String fieldName) {
    return CaseFormat.LOWER_UNDERSCORE.to(CaseFormat.UPPER_UNDERSCORE, fieldName);
}

From source file:com.google.template.soy.types.proto.JsQualifiedNameHelper.java

/** Performs camelcase translation. */
private static String computeSoyName(FieldDescriptor field) {
    return CaseFormat.LOWER_UNDERSCORE.to(CaseFormat.LOWER_CAMEL, field.getName());
}

From source file:com.evolveum.midpoint.repo.sql.util.MidPointPhysicalNamingStrategy.java

@Override
public Identifier toPhysicalTableName(Identifier identifier, JdbcEnvironment jdbcEnvironment) {
    String name = identifier.getText();
    if (name.startsWith("m_") || "hibernate_sequence".equals(name)) {
        return identifier;
    }//from  w  w w  .  j  av  a2 s.  c  o m

    name = name.substring(1);
    name = "m_" + CaseFormat.UPPER_CAMEL.to(CaseFormat.LOWER_UNDERSCORE, name);
    name = RUtil.fixDBSchemaObjectNameLength(name);

    Identifier i = new Identifier(name, identifier.isQuoted());

    LOGGER.trace("toPhysicalTableName {} -> {}", identifier, i);

    return i;
}

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:com.google.api.codegen.LanguageUtil.java

public static String lowerCamelToLowerUnderscore(String name) {
    return CaseFormat.LOWER_CAMEL.to(CaseFormat.LOWER_UNDERSCORE, name);
}

From source file:sklearn.Transformer.java

protected String name() {
    Class<? extends Transformer> clazz = getClass();

    String name = clazz.getSimpleName();

    return CaseFormat.UPPER_CAMEL.to(CaseFormat.LOWER_UNDERSCORE, name);
}

From source file:pl.wavesoftware.wfirma.api.core.model.ApiModule.java

/**
 * Gets a request module path//from w  ww .ja v  a  2  s.co m
 *
 * @param apiClass a domain class
 * @return a string for request
 */
@Nonnull
public static String getRequestModulePath(@Nonnull Class<? extends Api> apiClass) {
    checkNotNull(apiClass);
    String name = apiClass.getSimpleName().replaceAll("Api$", "");
    return CaseFormat.UPPER_CAMEL.to(CaseFormat.LOWER_UNDERSCORE, name);
}

From source file:io.soliton.protobuf.plugin.TypeMap.java

/**
 * @param name/*w  w  w .  j a  v a2  s .c  o m*/
 * @return
 */
@VisibleForTesting
static String createOuterJavaClassname(String name) {
    if (name.endsWith(".proto")) {
        name = name.substring(0, name.length() - ".proto".length());
    }
    name = Iterables.getLast(Splitter.on('/').split(name));
    name = name.replace('-', '_');
    name = CaseFormat.LOWER_UNDERSCORE.to(CaseFormat.UPPER_CAMEL, name);
    return Character.toUpperCase(name.charAt(0)) + name.substring(1);
}

From source file:com.facebook.buck.rules.Description.java

static BuildRuleType getBuildRuleType(String descriptionClassName) {
    descriptionClassName = MoreStrings.stripPrefix(descriptionClassName, "Abstract")
            .orElse(descriptionClassName);
    descriptionClassName = MoreStrings.stripSuffix(descriptionClassName, "Description")
            .orElse(descriptionClassName);
    return BuildRuleType.of(CaseFormat.UPPER_CAMEL.to(CaseFormat.LOWER_UNDERSCORE, descriptionClassName));
}