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.opengamma.strata.product.credit.PaymentOnDefault.java

/**
 * Obtains an instance from the specified unique name.
 * /* w w  w  . jav a 2  s.  c  o  m*/
 * @param uniqueName  the unique name
 * @return the type
 * @throws IllegalArgumentException if the name is not known
 */
@FromString
public static PaymentOnDefault of(String uniqueName) {
    ArgChecker.notNull(uniqueName, "uniqueName");
    return valueOf(CaseFormat.UPPER_CAMEL.to(CaseFormat.UPPER_UNDERSCORE, uniqueName));
}

From source file:com.spectralogic.ds3cli.command.CliCommandFactory.java

public static CliCommand getCommandExecutor(final String commandName) throws CommandException {
    final String commandCamel = CaseFormat.UPPER_UNDERSCORE.to(CaseFormat.UPPER_CAMEL, commandName.toString());

    final Iterable<CliCommand> implementations = getAllCommands();
    for (final CliCommand implementation : implementations) {
        final String className = implementation.getClass().getSimpleName();
        if (className.equalsIgnoreCase(commandCamel)) {
            return implementation;
        }//from   ww w .  j a va2s  . co  m
    }
    throw new CommandException("No command class: " + commandName);
}

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

public static String upperCamelToUpperUnderscore(String name) {
    name = CommonAcronyms.camelizeUpperAcronyms(name);
    return CaseFormat.UPPER_CAMEL.to(CaseFormat.UPPER_UNDERSCORE, name);
}

From source file:com.opengamma.strata.product.credit.ProtectionStartOfDay.java

/**
 * Obtains an instance from the specified unique name.
 * //from ww w  . ja  v a2  s.  co  m
 * @param uniqueName  the unique name
 * @return the type
 * @throws IllegalArgumentException if the name is not known
 */
@FromString
public static ProtectionStartOfDay of(String uniqueName) {
    ArgChecker.notNull(uniqueName, "uniqueName");
    return valueOf(CaseFormat.UPPER_CAMEL.to(CaseFormat.UPPER_UNDERSCORE, uniqueName));
}

From source file:com.sebrichard.mfgen.MetaFieldUtil.java

public static String fieldNameFromMetaField(@NotNull PsiField field) {
    Preconditions.checkArgument(isMetaField(field));

    return CaseFormat.UPPER_UNDERSCORE.to(CaseFormat.LOWER_CAMEL, field.getName().replaceFirst(PREFIX, ""));
}

From source file:org.jclouds.azure.management.domain.DeploymentSlot.java

public static DeploymentSlot fromValue(String type) {
    try {/*from  www.  j  a v  a2 s  .co m*/
        return valueOf(CaseFormat.UPPER_CAMEL.to(CaseFormat.UPPER_UNDERSCORE, checkNotNull(type, "type")));
    } catch (IllegalArgumentException e) {
        return null;
    }
}

From source file:com.opengamma.basics.BuySell.java

/**
 * Obtains the type from a unique name./* w ww.ja  va 2  s.co m*/
 * 
 * @param uniqueName  the unique name
 * @return the type
 * @throws IllegalArgumentException if the name is not known
 */
@FromString
public static BuySell of(String uniqueName) {
    ArgChecker.notNull(uniqueName, "uniqueName");
    return valueOf(CaseFormat.UPPER_CAMEL.to(CaseFormat.UPPER_UNDERSCORE, uniqueName));
}

From source file:com.opengamma.strata.product.etd.EtdOptionType.java

/**
 * Obtains an instance from the specified unique name.
 * //from  w  w  w  . j  a v a  2 s.  c o m
 * @param uniqueName  the unique name
 * @return the type
 * @throws IllegalArgumentException if the name is not known
 */
@FromString
public static EtdOptionType of(String uniqueName) {
    ArgChecker.notNull(uniqueName, "uniqueName");
    return valueOf(CaseFormat.UPPER_CAMEL.to(CaseFormat.UPPER_UNDERSCORE, uniqueName));
}

From source file:org.jclouds.ec2.domain.VirtualizationType.java

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

From source file:org.jclouds.azure.management.domain.OSType.java

public static OSType fromValue(String type) {
    try {/* w w  w .j a  v a  2 s .  c o  m*/
        return valueOf(CaseFormat.UPPER_CAMEL.to(CaseFormat.UPPER_UNDERSCORE, checkNotNull(type, "type")));
    } catch (IllegalArgumentException e) {
        return UNRECOGNIZED;
    }
}