List of usage examples for com.google.common.base CaseFormat LOWER_UNDERSCORE
CaseFormat LOWER_UNDERSCORE
To view the source code for com.google.common.base CaseFormat LOWER_UNDERSCORE.
Click Source Link
From source file:org.seedstack.seed.core.internal.ErrorsTool.java
private String formatCamelCase(String value) { String result = CaseFormat.UPPER_CAMEL.to(CaseFormat.LOWER_UNDERSCORE, value).replace("_", " "); return result.substring(0, 1).toUpperCase() + result.substring(1); }
From source file:com.robrit.moofluids.common.util.EntityHelper.java
public static ResourceLocation getLootTable(final String entityName) { final String entityNameLocalized = CaseFormat.UPPER_CAMEL.to(CaseFormat.LOWER_UNDERSCORE, entityName); return new ResourceLocation(ModInformation.MOD_ID, "entities/" + entityNameLocalized); }
From source file:com.zaradai.kunzite.trader.tools.EodDownloadOptionsParser.java
private String toCamelCase(String type) { return CaseFormat.LOWER_UNDERSCORE.to(CaseFormat.UPPER_CAMEL, type.toLowerCase()); }
From source file:com.spectralogic.ds3cli.Ds3Cli.java
private String listAllCommands() { final StringBuilder commands = new StringBuilder("Installed Commands: "); final Iterator<CliCommand> implementations = getAllCommands(); while (implementations.hasNext()) { final CliCommand implementation = implementations.next(); commands.append(CaseFormat.UPPER_CAMEL.to(CaseFormat.LOWER_UNDERSCORE, implementation.getClass().getSimpleName())); if (implementations.hasNext()) { commands.append(", "); }/*from w w w .j av a2s .c o m*/ } return commands.toString(); }
From source file:com.thoughtworks.go.spark.spa.spring.InitialContextProvider.java
private String humanizedControllerName(Class<? extends SparkController> controller) { return CaseFormat.UPPER_CAMEL.converterTo(CaseFormat.LOWER_UNDERSCORE) .convert(controller.getSimpleName().replaceAll("(Delegate|Controller)", "")); }
From source file:com.cinchapi.concourse.server.plugin.PluginConfiguration.java
/** * Define a default preference to be used if not provided in the prefs file. * /*from www . j av a 2 s . c o m*/ * @param key * @param value */ protected void addDefault(String key, Object value) { SystemPreference sys = null; try { sys = SystemPreference.valueOf(CaseFormat.LOWER_UNDERSCORE.to(CaseFormat.UPPER_UNDERSCORE, key)); } catch (IllegalArgumentException e) { /* no-op */} if (sys != null) { addDefault(sys, value); } else { defaults.put(key, value); } }
From source file:org.syncany.plugins.transfer.TransferPluginUtil.java
/** * Determines the {@link TransferPlugin} class for a given * {@link TransferSettings} class.//from www . ja v a 2 s. c o m */ public static Class<? extends TransferPlugin> getTransferPluginClass( Class<? extends TransferSettings> transferSettingsClass) { String pluginNameIdentifier = TransferPluginUtil.getPluginPackageName(transferSettingsClass); if (pluginNameIdentifier == null) { throw new RuntimeException( "The transfer settings are orphan (" + transferSettingsClass.getName() + ")"); } else { try { String pluginPackageIdentifier = CaseFormat.UPPER_CAMEL.to(CaseFormat.LOWER_UNDERSCORE, pluginNameIdentifier); String transferPluginClassName = MessageFormat.format(PLUGIN_TRANSFER_PLUGIN_CLASS_NAME, pluginPackageIdentifier, pluginNameIdentifier); return Class.forName(transferPluginClassName).asSubclass(TransferPlugin.class); } catch (Exception e) { throw new RuntimeException("Cannot find matching transfer plugin class for plugin settings (" + transferSettingsClass.getName() + ")"); } } }
From source file:com.cinchapi.concourse.shell.SyntaxTools.java
/** * Check to see if {@code line} is a command that uses short syntax. Short * syntax allows the user to call an API method without starting the command * with {@code concourse.}. This method compares the line to the list of * {@code options} to see if it should be "expanded" from short syntax. * Otherwise, the original line is returned. * //from w w w.ja v a 2s.c om * @param line * @param options * @return the expanded line, if it is using short syntax, otherwise the * original line */ public static String handleShortSyntax(String line, List<String> options) { final String prepend = "concourse."; if (line.equalsIgnoreCase("time") || line.equalsIgnoreCase("date")) { return line + " \"now\""; } else if (!line.contains("(")) { // If there are no parens in the line, then we assume that this is a // single(e.g non-nested) function invocation. if (line.startsWith(prepend)) { boolean hasArgs = line.split("\\s+").length > 1; if (!hasArgs) { line += "()"; } return line; } else { String[] query = line.split("\\s+"); String cmd = query[0]; if (cmd.contains("_")) { // CON-457,GH-182 String replacement = CaseFormat.LOWER_UNDERSCORE.to(CaseFormat.LOWER_CAMEL, cmd); line = line.replaceFirst(cmd, replacement); } String expanded = prepend + line.trim(); Pattern pattern = Pattern.compile(expanded.split("\\s|\\(")[0]); for (String option : options) { if (pattern.matcher(option).matches()) { boolean hasArgs = expanded.split("\\s+").length > 1; if (!hasArgs) { expanded += "()"; } return expanded; } } } } else { Set<String> shortInvokedMethods = parseShortInvokedMethods(line); for (String method : shortInvokedMethods) { if (options.contains(prepend + method)) { line = line.replaceAll("(?<!\\_)" + method + "\\(", prepend + method + "\\("); } } } return line; }
From source file:com.google.api.tools.framework.model.Field.java
/** * Returns the JSON name of the field. */ public String getJsonName() { return CaseFormat.LOWER_UNDERSCORE.to(CaseFormat.LOWER_CAMEL, getSimpleName()); }
From source file:com.facebook.presto.operator.aggregation.AggregationUtils.java
public static String generateAggregationName(String baseName, Type outputType, List<Type> inputTypes) { StringBuilder sb = new StringBuilder(); sb.append(CaseFormat.LOWER_CAMEL.to(CaseFormat.UPPER_CAMEL, outputType.getTypeSignature().toString())); for (Type inputType : inputTypes) { sb.append(CaseFormat.LOWER_CAMEL.to(CaseFormat.UPPER_CAMEL, inputType.getTypeSignature().toString())); }/*w ww . ja va 2 s.c o m*/ sb.append(CaseFormat.LOWER_UNDERSCORE.to(CaseFormat.UPPER_CAMEL, baseName.toLowerCase(ENGLISH))); return sb.toString(); }