Example usage for java.lang String toUpperCase

List of usage examples for java.lang String toUpperCase

Introduction

In this page you can find the example usage for java.lang String toUpperCase.

Prototype

public String toUpperCase() 

Source Link

Document

Converts all of the characters in this String to upper case using the rules of the default locale.

Usage

From source file:com.opengamma.web.analytics.rest.WebUiResource.java

private static AnalyticsView.GridType gridType(String gridType) {
    return AnalyticsView.GridType.valueOf(gridType.toUpperCase());
}

From source file:jp.codic.plugins.netbeans.utils.CodicUtils.java

/**
 * Convert from default case to snake case.
 *
 * @param text//from  w  w w  . j  a va  2  s.  co m
 * @param lower {@code true} if lowercase is used, otherwise {@code false}
 * @return snake case text
 */
public static String toSnakeCase(String text, boolean lower) {
    if (StringUtils.isEmpty(text)) {
        return text;
    }
    StringBuilder sb = new StringBuilder();
    String[] words = toWords(text);
    boolean first = true;
    for (String word : words) {
        if (first) {
            first = false;
        } else {
            sb.append("_"); // NOI18N
        }
        sb.append(lower ? word.toLowerCase() : word.toUpperCase());
    }
    return sb.toString();
}

From source file:com.cloudera.nav.sdk.model.HiveIdGenerator.java

public static String generateTableId(String sourceId, String databaseName, String tableName) {
    Preconditions.checkArgument(//from  w  ww.  ja  v  a 2 s . c o m
            !StringUtils.isEmpty(sourceId) && !StringUtils.isEmpty(databaseName)
                    && !StringUtils.isEmpty(tableName),
            "SourceId, database name, and table name must be supplied to " + "generate Hive table identity");
    return MD5IdGenerator.generateIdentity(sourceId, databaseName.toUpperCase(), tableName.toUpperCase());
}

From source file:de.undercouch.citeproc.bibtex.DateParser.java

/**
 * Retrieves and caches a list of month names for a given locale
 * @param locale the locale//from   w  ww . j  a  v a 2  s .  c om
 * @return the list of month names (short and long). All names are
 * converted to upper case
 */
private static Map<String, Integer> getMonthNames(Locale locale) {
    Map<String, Integer> r = MONTH_NAMES_CACHE.get(locale);
    if (r == null) {
        DateFormatSymbols symbols = DateFormatSymbols.getInstance(locale);
        r = new HashMap<String, Integer>(24);

        //insert long month names
        String[] months = symbols.getMonths();
        for (int i = 0; i < months.length; ++i) {
            String m = months[i];
            if (!m.isEmpty()) {
                r.put(m.toUpperCase(), i + 1);
            }
        }

        //insert short month names
        String[] shortMonths = symbols.getShortMonths();
        for (int i = 0; i < shortMonths.length; ++i) {
            String m = shortMonths[i];
            if (!m.isEmpty()) {
                r.put(m.toUpperCase(), i + 1);
            }
        }
        MONTH_NAMES_CACHE.put(locale, r);
    }

    return r;
}

From source file:fll.xml.XMLUtils.java

/**
 * Get the winner criteria for a particular element.
 *//*from w ww  .  j a  va2 s  . c o m*/
public static WinnerType getWinnerCriteria(final Element element) {
    if (element.hasAttribute("winner")) {
        final String str = element.getAttribute("winner");
        final String sortStr;
        if (!str.isEmpty()) {
            sortStr = str.toUpperCase();
        } else {
            sortStr = "HIGH";
        }
        return Enum.valueOf(WinnerType.class, sortStr);
    } else {
        return WinnerType.HIGH;
    }
}

From source file:business.model.CaptchaModel.java

/**
 *
 * @param token//  ww w .  ja  v a  2s .  c  om
 * @param captchaText
 * @return
 */
public static boolean isCaptchaNotMatch(Token token, String captchaText) {
    return !captchaText.toUpperCase().equals(token.getCaptchaText());
}

From source file:io.trivium.Central.java

/**
 * parses command line arguments and sets up the server.
 *
 * @param args command line arguments//www.  java2 s . c om
 * @return true, if normal startup can proceed
 * @throws Exception
 */
public static boolean setup(String[] args) throws Exception {
    CommandLineParser parser = new PosixParser();
    Options opts = new Options();
    opts.addOption("ll", "loglevel", true,
            "turn logging to one of the following levels: fine,info,warning,severe");
    opts.addOption("h", "help", false, "show help");
    opts.addOption("?", "help", false, "show help");
    opts.addOption("p", "path", true, "base path for the local storage");
    opts.addOption("hp", "http", true, "port for the http interface, defaults to port 12345");
    opts.addOption("cs", "cleanStore", false, "re-initializes the local store (all information will be lost)");
    opts.addOption("cq", "cleanQueue", false, "re-initializes the local ingestion queue");
    opts.addOption("t", "test", true, "starts test mode with target scope (default core)");
    opts.addOption("c", "compress", true, "enable/disable snappy compression (default=true)");
    opts.addOption("b", "build", false, "generate executable shell script");

    CommandLine cmd = parser.parse(opts, args);
    if (cmd.hasOption("help")) {
        HelpFormatter formatter = new HelpFormatter();
        formatter.printHelp("trivium", opts);
        return false;
    }
    if (cmd.hasOption("build")) {
        uuencode();
        return false;
    }

    if (cmd.hasOption("loglevel")) {
        String val = cmd.getOptionValue("loglevel");
        try {
            Level l = Level.parse(val.toUpperCase());
            Central.setLogLevel(val);
        } catch (Exception ex) {
            logger.log(Level.WARNING, "log level was not recognized, falling back to default value");
        }
    }
    if (cmd.hasOption("compress")) {
        String val = cmd.getOptionValue("compress");
        if (val.equalsIgnoreCase("false")) {
            Central.setProperty("compression", "false");
        } else {
            Central.setProperty("compression", "true");
        }
    } else {
        Central.setProperty("compression", "true");
    }
    if (cmd.hasOption("test")) {
        String target = cmd.getOptionValue("test");
        Central.setProperty("test", target);
    }
    if (cmd.hasOption("path")) {
        String val = cmd.getOptionValue("path");
        if (val != null && val.length() > 1) {
            if (!val.endsWith(File.separator))
                val += File.separator;
            Central.setProperty("basePath", val);
        } else {
            Central.setProperty("basePath", System.getProperty("user.dir"));
        }
    } else {
        Central.setProperty("basePath", System.getProperty("user.dir"));
    }
    if (cmd.hasOption("cleanStore")) {
        StoreUtils.cleanStore();
    }
    if (cmd.hasOption("cleanQueue")) {
        StoreUtils.cleanQueue();
    }

    if (cmd.hasOption("http")) {
        String val = cmd.getOptionValue("http");
        if (val != null && val.length() > 1) {
            try {
                int port = Integer.parseInt(val);
                if (port > 0 && port < 65535)
                    Central.setProperty("httpPort", val);
                else
                    throw new Exception("out of range");
            } catch (Exception ex) {
                Central.setProperty("httpPort", "12345");
            }
        } else {
            Central.setProperty("httpPort", "12345");
        }
    } else {
        Central.setProperty("httpPort", "12345");
    }

    Hardware.discover();

    return true;
}

From source file:com.adaptris.core.management.BootstrapProperties.java

private static boolean enabledByDefault(String key) {
    try {//from  w w  w .  j a  v a2  s.  c  o  m
        return BootstrapFeature.valueOf(key.toUpperCase()).enabledByDefault();
    } catch (IllegalArgumentException e) {
        return false;
    }
}

From source file:fll.xml.XMLUtils.java

/**
 * Get the score type for a particular element.
 *//*from   w  w  w . j  av a  2 s. c o  m*/
public static ScoreType getScoreType(final Element element) {
    if (element.hasAttribute("scoreType")) {
        final String str = element.getAttribute("scoreType");
        final String sortStr;
        if (!str.isEmpty()) {
            sortStr = str.toUpperCase();
        } else {
            sortStr = "INTEGER";
        }
        return Enum.valueOf(ScoreType.class, sortStr);
    } else {
        return ScoreType.INTEGER;
    }
}

From source file:org.eclipse.lyo.testsuite.server.trsutils.FetchUtil.java

/**
 * This method performs authentication based on the config.properties' 
 * AuthType setting.//from  w ww. ja v a 2 s  . co  m
 * 
 * @param uri
 * @param httpClient
 * @param httpContext
 * @param model
 * @param get
 * @param handler
 * @return
 * @throws FileNotFoundException
 * @throws IOException
 * @throws ClientProtocolException
 * @throws URISyntaxException
 */
private static Model attemptAuthentication(String uri, HttpClient httpClient, HttpContext httpContext,
        Model model, HttpGet get, RDFModelResponseHandler handler)
        throws FileNotFoundException, IOException, ClientProtocolException, URISyntaxException {
    // Check the config.properties to see if the user is overriding
    // the WWW-Authenticate header.
    String override = TestCore.getConfigPropertiesInstance().getProperty("AuthType");
    AuthenticationTypes overrideType = AuthenticationTypes.valueOf(override.toUpperCase());

    switch (overrideType) {
    case OAUTH:
        return perform2LeggedOauth(httpClient, httpContext, get, uri);

    case BASIC:
        return performBasicAuthentication(httpClient, httpContext, get, uri);

    case HEADER:
        Header authTypes[] = handler.getAuthTypes();

        // Determine the authentication type to attempt based on the
        // server's response. Attempt the first type encountered that
        // both the server and the tests support.
        for (Header authType : authTypes) {
            if (authType.getValue().startsWith("OAuth ")) {
                return perform2LeggedOauth(httpClient, httpContext, get, uri);
            } else if (authType.getValue().startsWith("Basic ")) {
                return performBasicAuthentication(httpClient, httpContext, get, uri);
            }
        }
    }

    throw new InvalidRDFResourceException(Messages.getServerString("fetch.util.authentication.unknown"));
}