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.amazonaws.util.awsclientgenerator.generators.cpp.ErrorFormatter.java

public static String formatErrorConstName(String errorName) {
    String upper = CaseFormat.UPPER_CAMEL.to(CaseFormat.UPPER_UNDERSCORE, errorName.replaceAll("\\.", "_"));
    if (upper.endsWith("_ERROR")) {
        upper = upper.substring(0, upper.length() - "_ERROR".length());
    }/*  w ww  . jav  a2s.c om*/
    if (upper.endsWith("_EXCEPTION")) {
        upper = upper.substring(0, upper.length() - "_EXCEPTION".length());
    }
    return upper;
}

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

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

From source file:org.jclouds.apis.ApiType.java

public static ApiType fromValue(String type) {
    checkNotEmpty(type, "type must be defined");
    try {/* www.ja v  a 2 s  .c  o  m*/
        return valueOf(CaseFormat.LOWER_CAMEL.to(CaseFormat.UPPER_UNDERSCORE, type));
    } catch (IllegalArgumentException e) {
        return UNRECOGNIZED;
    }
}

From source file:org.jclouds.orion.domain.BlobType.java

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

From source file:org.jclouds.aws.ec2.domain.RootDeviceType.java

public static RootDeviceType fromValue(String v) {
    try {//from w w w.  j av  a2 s .c o m
        return valueOf(CaseFormat.LOWER_HYPHEN.to(CaseFormat.UPPER_UNDERSCORE, v));
    } catch (IllegalArgumentException e) {
        return UNRECOGNIZED;
    }
}

From source file:org.jclouds.cloudstack.config.CredentialType.java

public static CredentialType fromValue(String credentialType) {
    return valueOf(CaseFormat.LOWER_CAMEL.to(CaseFormat.UPPER_UNDERSCORE,
            checkNotNull(credentialType, "credentialType")));
}

From source file:org.jclouds.dimensiondata.cloudcontrol.domain.State.java

public static State fromValue(String state) {
    try {//from   w  w w .j  a va 2 s  .  com
        return valueOf(CaseFormat.UPPER_CAMEL.to(CaseFormat.UPPER_UNDERSCORE, checkNotNull(state, "state")));
    } catch (IllegalArgumentException e) {
        return UNRECOGNIZED;
    }
}

From source file:com.opengamma.strata.calc.ReportingCurrencyType.java

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

From source file:com.opengamma.strata.market.curve.node.CurveNodeDateType.java

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

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

public static DeploymentStatus fromValue(String type) {
    try {/*from   ww w .  j  a v  a2s .  c  o  m*/
        return valueOf(CaseFormat.UPPER_CAMEL.to(CaseFormat.UPPER_UNDERSCORE, checkNotNull(type, "type")));
    } catch (IllegalArgumentException e) {
        return null;
    }
}