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:org.jclouds.ecs.domain.LoadBalancerState.java

public static LoadBalancerState fromValue(String state) {
    try {/*from   ww w. j  a va2 s .  c o m*/
        return valueOf(CaseFormat.UPPER_CAMEL.to(CaseFormat.UPPER_UNDERSCORE, checkNotNull(state, "state")));
    } catch (IllegalArgumentException e) {
        return UNRECOGNIZED;
    }
}

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

public static RoleSize fromValue(String type) {
    try {/*from  w  w w  .  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:org.jclouds.ec2.domain.Hypervisor.java

public static Hypervisor fromValue(String v) {
    try {/* ww  w  . j a va  2s .  co m*/
        return valueOf(CaseFormat.LOWER_HYPHEN.to(CaseFormat.UPPER_UNDERSCORE, v));
    } catch (IllegalArgumentException e) {
        return UNRECOGNIZED;
    }
}

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

public static NetworkType fromValue(String type) {
    try {/* ww w .ja  v  a  2s. com*/
        return valueOf(CaseFormat.UPPER_CAMEL.to(CaseFormat.UPPER_UNDERSCORE, checkNotNull(type, "type")));
    } catch (IllegalArgumentException e) {
        return UNRECOGNIZED;
    }
}

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

/**
 * Obtains the type from a unique name./*ww  w  .  jav  a 2 s . com*/
 * 
 * @param uniqueName  the unique name
 * @return the type
 * @throws IllegalArgumentException if the name is not known
 */
@FromString
public static SeniorityLevel of(String uniqueName) {
    ArgChecker.notNull(uniqueName, "uniqueName");
    String str = CaseFormat.UPPER_CAMEL.to(CaseFormat.UPPER_UNDERSCORE, uniqueName);
    if (str.endsWith("1") || str.endsWith("2")) {
        return valueOf(str.substring(0, str.length() - 1) + "_" + str.substring(str.length() - 1));
    }
    return valueOf(str);
}

From source file:org.jclouds.openstack.nova.v2_0.domain.BackupType.java

public static BackupType fromValue(String backupType) {
    return valueOf(
            CaseFormat.LOWER_HYPHEN.to(CaseFormat.UPPER_UNDERSCORE, checkNotNull(backupType, "backupType")));
}

From source file:org.jclouds.azure.storage.blob.domain.BlobType.java

public static BlobType fromValue(String type) {
    try {/*from   w w  w  .  j  ava  2s  .c  o  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.swaption.SettlementType.java

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

From source file:org.jclouds.azure.storage.blob.domain.LeaseStatus.java

public static LeaseStatus fromValue(String type) {
    try {/* w  ww  .  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:org.jclouds.cloudstack.domain.StorageType.java

public static StorageType fromValue(String type) {
    try {// w  ww .  j  a  va  2 s.  com
        return valueOf(CaseFormat.LOWER_CAMEL.to(CaseFormat.UPPER_UNDERSCORE, checkNotNull(type, "type")));
    } catch (IllegalArgumentException e) {
        return UNRECOGNIZED;
    }
}