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.finance.common.FutureOptionPremiumStyle.java

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

From source file:org.jclouds.glesys.domain.ServerState.java

public static ServerState fromValue(String state) {
    try {/*from   ww w.  j av  a2  s .c om*/
        return valueOf(CaseFormat.UPPER_CAMEL.to(CaseFormat.UPPER_UNDERSCORE, checkNotNull(state, "state")));
    } catch (IllegalArgumentException e) {
        return UNRECOGNIZED;
    }
}

From source file:org.jclouds.aws.cloudwatch.domain.StandardUnit.java

public static StandardUnit fromValue(String state) {
    try {/*from  w w w. jav  a2  s. c o m*/
        return valueOf(CaseFormat.UPPER_CAMEL.to(CaseFormat.UPPER_UNDERSCORE,
                checkNotNull(state, "state").replace("/", "_PER_")));
    } catch (IllegalArgumentException e) {
        return UNRECOGNIZED;
    }
}

From source file:com.opengamma.strata.pricer.CompoundedRateType.java

/**
 * Obtains an instance from the specified unique name.
 * /*from   w  w  w . ja  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 CompoundedRateType of(String uniqueName) {
    ArgChecker.notNull(uniqueName, "uniqueName");
    return valueOf(CaseFormat.UPPER_CAMEL.to(CaseFormat.UPPER_UNDERSCORE, uniqueName));
}

From source file:org.jclouds.cloudstack.domain.NetworkOfferingAvailabilityType.java

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

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

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

From source file:com.opengamma.strata.source.SearchMatchStatus.java

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

From source file:org.jclouds.gogrid.domain.ObjectType.java

public static ObjectType fromValue(String type) {
    if ("StorageDNS".equals(type))
        return STORAGE_DNS;
    try {// w w w  .  j ava 2 s  . c o  m
        return valueOf(CaseFormat.UPPER_CAMEL.to(CaseFormat.UPPER_UNDERSCORE, checkNotNull(type, "type")));
    } catch (IllegalArgumentException e) {
        return UNRECOGNIZED;
    }
}

From source file:org.ow2.sirocco.cloudmanager.api.openstack.server.resources.cinder.Status.java

public static Status fromValue(String status) {
    try {/*from  ww  w .  j ava  2 s . co  m*/
        return valueOf(CaseFormat.LOWER_HYPHEN.to(CaseFormat.UPPER_UNDERSCORE, checkNotNull(status, "status")));
    } catch (IllegalArgumentException e) {
        return UNRECOGNIZED;
    }
}

From source file:com.cinchapi.common.base.CaseFormats.java

/**
 * Detect the {@link CaseFormat} that describes the {@code string}.
 * //from  www .  j av a2 s. c  om
 * @param string
 * @return the best fit {@link CaseFormat} description
 */
public static CaseFormat detect(String string) {
    if (string.contains("-")) {
        return CaseFormat.LOWER_HYPHEN;
    } else if (string.contains("_")) {
        for (char c : string.toCharArray()) {
            if (Character.isUpperCase(c)) {
                return CaseFormat.UPPER_UNDERSCORE;
            }
        }
        return CaseFormat.LOWER_UNDERSCORE;
    } else if (Character.isLowerCase(string.toCharArray()[0])) {
        return CaseFormat.LOWER_CAMEL;
    } else {
        return CaseFormat.UPPER_CAMEL;
    }
}