List of usage examples for com.google.common.base CaseFormat LOWER_HYPHEN
CaseFormat LOWER_HYPHEN
To view the source code for com.google.common.base CaseFormat LOWER_HYPHEN.
Click Source Link
From source file:org.apache.niolex.common.guava.GuavaStrings.java
/** * @param args/*w w w. ja v a2 s .c o m*/ */ public static void main(String[] args) { String str = CaseFormat.LOWER_HYPHEN.to(CaseFormat.LOWER_CAMEL, "good-morning"); System.out.println("lower camel => " + str); Joiner joiner = Joiner.on("; ").useForNull("null"); str = joiner.join("nice", "talk", null, "name"); System.out.println("join on ';' => " + str); }
From source file:org.ballerinalang.composer.service.workspace.tools.ModelGenerator.java
public static void main(String args[]) { JsonObject nodes = getContext();//from w ww. j a v a2 s . c o m for (Map.Entry<String, JsonElement> entry : nodes.entrySet()) { JsonObject node = (JsonObject) entry.getValue(); String lowerHyphenName = CaseFormat.LOWER_CAMEL.to(CaseFormat.LOWER_HYPHEN, entry.getKey()); generateSourceFiles(node, "node.hbs", "tree/" + lowerHyphenName + ".js"); generateSourceFiles(node, "abstract-node.hbs", "tree/abstract-tree/" + lowerHyphenName + ".js"); } generateSourceFiles(nodes, "abstract-tree-util.hbs", "abstract-tree-util.js"); generateSourceFiles(nodes, "node-factory.hbs", "node-factory.js"); generateSourceFiles(nodes, "positioning-util.hbs", "positioning-util.js"); generateSourceFiles(nodes, "sizing-util.hbs", "sizing-util.js"); generateSourceFiles(nodes, "error-rendering-util.hbs", "error-rendering-util.js"); }
From source file:org.ballerinalang.composer.tools.ModelGenerator.java
public static void main(String args[]) { JsonObject nodes = getContext();// www . j av a2 s . c o m for (Map.Entry<String, JsonElement> entry : nodes.entrySet()) { JsonObject node = (JsonObject) entry.getValue(); String lowerHyphenName = CaseFormat.LOWER_CAMEL.to(CaseFormat.LOWER_HYPHEN, entry.getKey()); generateSourceFiles(node, "node.hbs", "tree/" + lowerHyphenName + ".js"); generateSourceFiles(node, "abstract-node.hbs", "tree/abstract-tree/" + lowerHyphenName + ".js"); } generateSourceFiles(nodes, "abstract-tree-util.hbs", "abstract-tree-util.js"); generateSourceFiles(nodes, "node-factory.hbs", "node-factory.js"); generateSourceFiles(nodes, "positioning-util.hbs", "positioning-util.js"); generateSourceFiles(nodes, "sizing-util.hbs", "sizing-util.js"); generateSourceFiles(nodes, "error-rendering-util.hbs", "error-rendering-util.js"); generateSourceFiles(nodes, "formatting-util.hbs", "formatting-util.js"); }
From source file:org.gaul.s3proxy.AuthenticationType.java
static AuthenticationType fromString(String string) { return AuthenticationType.valueOf(CaseFormat.LOWER_HYPHEN.to(CaseFormat.UPPER_UNDERSCORE, string)); }
From source file:io.kazuki.v0.internal.helper.StringHelper.java
public static String toCamelCase(String value) { Preconditions.checkNotNull(value, "value"); String canonical = value.replace('.', '-').toLowerCase(); return CaseFormat.LOWER_HYPHEN.to(CaseFormat.LOWER_CAMEL, canonical); }
From source file:org.jclouds.ec2.domain.VirtualizationType.java
public static VirtualizationType fromValue(String v) { try {//from w ww .java2 s . c o m return valueOf(CaseFormat.LOWER_HYPHEN.to(CaseFormat.UPPER_UNDERSCORE, v)); } catch (IllegalArgumentException e) { return UNRECOGNIZED; } }
From source file:org.jclouds.ec2.domain.Hypervisor.java
public static Hypervisor fromValue(String v) { try {// w ww. ja va 2s . c o m return valueOf(CaseFormat.LOWER_HYPHEN.to(CaseFormat.UPPER_UNDERSCORE, v)); } catch (IllegalArgumentException e) { return UNRECOGNIZED; } }
From source file:com.cinchapi.common.base.CaseFormats.java
/** * Detect the {@link CaseFormat} that describes the {@code string}. * // www .j a va 2 s .co m * @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; } }
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.aws.ec2.domain.RootDeviceType.java
public static RootDeviceType fromValue(String v) { try {// w ww. ja va 2 s .com return valueOf(CaseFormat.LOWER_HYPHEN.to(CaseFormat.UPPER_UNDERSCORE, v)); } catch (IllegalArgumentException e) { return UNRECOGNIZED; } }