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

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

Introduction

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

Prototype

CaseFormat UPPER_CAMEL

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

Click Source Link

Document

Java and C++ class naming convention, e.g., "UpperCamel".

Usage

From source file:paperparcel.AdapterNameGenerator.java

/**
 * Creates a name based on the given {@link TypeName}. Names are constants, so will use
 * {@link CaseFormat#UPPER_UNDERSCORE} formatting.
 *///from  w w w  . java  2s . c o m
String getName(TypeName typeName) {
    String name = typeToNames.get(typeName);
    if (name != null) {
        return name;
    }
    name = getNameInternal(typeName);
    name = CaseFormat.UPPER_CAMEL.to(CaseFormat.UPPER_UNDERSCORE, name);
    name = adapterNames.getUniqueName(name);
    typeToNames.put(typeName, name);
    return name;
}

From source file:com.eucalyptus.auth.util.ClassPathSystemRoleProvider.java

private String getResourceName(String type) {
    return CaseFormat.UPPER_CAMEL.to(CaseFormat.LOWER_HYPHEN, getName() + type) + ".json";
}

From source file:es.sm2.openppm.api.converter.common.SettingGroupDTOConverter.java

/**
 * Convert BD model object into DTO model
 *
 * @param model/*from   www .j a v  a 2  s  .  c om*/
 * @return
 */
@Override
public SettingGroupDTO toDTO(Class<? extends ApplicationSetting> model) {

    String name = CaseFormat.UPPER_CAMEL.to(CaseFormat.UPPER_UNDERSCORE, model.getSimpleName());

    SettingGroupDTO dto = new SettingGroupDTO(name);
    //        dto.setSettingList(new HashMap<String, String>());
    //
    //        for (ApplicationSetting applicationSetting : model.getEnumConstants()) {
    //            dto.getSettingList().put(applicationSetting.name(), applicationSetting.getDefaultValue());
    //        }

    return dto;
}

From source file:com.groupon.jenkins.buildtype.install_packages.template.DotCiTemplate.java

private String getName() {
    String className = getClass().getSimpleName();
    return CaseFormat.UPPER_CAMEL.to(CaseFormat.LOWER_UNDERSCORE, className);
}

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

@VisibleForTesting
static String inferOuterClassName(FileDescriptorProto file) {
    String fileName = file.getName();
    if (fileName.endsWith(".proto")) {
        fileName = fileName.substring(0, fileName.length() - ".proto".length());
    }/*w  ww .j  av a  2s  .  c  o m*/
    fileName = Iterables.getLast(Splitter.on('/').split(fileName));
    fileName = fileName.replace('-', '_');
    fileName = CaseFormat.LOWER_UNDERSCORE.to(CaseFormat.UPPER_CAMEL, fileName);
    return Character.toUpperCase(fileName.charAt(0)) + fileName.substring(1);
}

From source file:com.appunity.ant.Utils.java

public static String toPinYin(String hzString) {
    /**/*from   w ww.  j av  a  2s  .co m*/
     * ?
     */
    HanyuPinyinOutputFormat format = new HanyuPinyinOutputFormat();
    format.setCaseType(HanyuPinyinCaseType.LOWERCASE);
    format.setToneType(HanyuPinyinToneType.WITHOUT_TONE);
    format.setVCharType(HanyuPinyinVCharType.WITH_V);

    char[] hzChars = new char[hzString.length()];
    for (int i = 0; i < hzString.length(); i++) {
        hzChars[i] = hzString.charAt(i);
    }

    int t0 = hzChars.length;
    StringBuilder sb = new StringBuilder();
    try {
        for (int i = 0; i < t0; i++) {
            char c = hzChars[i];
            String[] result = PinyinHelper.toHanyuPinyinStringArray(c, format);
            if (result != null && result.length > 0) {
                sb.append(CaseFormat.LOWER_CAMEL.to(CaseFormat.UPPER_CAMEL, result[0]));
            } else {
                sb.append(c);
            }
        }
    } catch (BadHanyuPinyinOutputFormatCombination e1) {
        if (sb.length() == 0) {
            sb.append("Anonymous");
        }
    }
    return sb.toString();
}

From source file:fm.pattern.tokamak.server.validation.UniqueValueValidator.java

public boolean isValid(PersistentEntity entity, ConstraintValidatorContext constraint) {
    final String value = (String) Reflection.get(entity, property);
    if (isBlank(value)) {
        return true;
    }/*from   w  ww  .  j  a v a  2s  .  c  o m*/

    String columnName = CaseFormat.UPPER_CAMEL.to(CaseFormat.LOWER_UNDERSCORE, property);

    String query = "select count(id) from " + getTableName(entity) + " where " + columnName
            + " = :value and id != :id";
    Query q = repository.query(query).setParameter("value", value).setParameter("id", entity.getId());

    return repository.count(q) == 0;
}

From source file:org.jclouds.s3.domain.Payer.java

public static Payer fromValue(String payer) {
    try {//from  www  . j  a  va  2s  .  c  om
        return valueOf(CaseFormat.UPPER_CAMEL.to(CaseFormat.UPPER_UNDERSCORE, payer));
    } catch (IllegalArgumentException e) {
        return UNRECOGNIZED;
    }
}

From source file:datamine.storage.idl.generator.TableTestDataGenerator.java

public static String getTestDataClassName(String tableName) {
    return new StringBuilder().append(CaseFormat.LOWER_UNDERSCORE.to(CaseFormat.UPPER_CAMEL, tableName))
            .append("TestData").toString();
}

From source file:org.eclipse.viatra.examples.cps.xform.m2t.util.FormatterUtil.java

public String purifyAndToUpperCamel(String string) {
    String str = purify(string.replace(' ', '_').toLowerCase());
    return CaseFormat.LOWER_UNDERSCORE.to(CaseFormat.UPPER_CAMEL, str);
}