List of usage examples for com.google.common.base CaseFormat LOWER_CAMEL
CaseFormat LOWER_CAMEL
To view the source code for com.google.common.base CaseFormat LOWER_CAMEL.
Click Source Link
From source file:org.apache.niolex.common.guava.GuavaStrings.java
/** * @param args/* www.j a va2s . c om*/ */ 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 w w. ja v a 2 s . c om 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();/*from w w w . j ava 2 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:com.marvinformatics.querydsl.HardcodedSchemaGenerator.java
public static void main(String[] args) throws Exception { Cluster cluster = Cluster.builder().addContactPoints("localhost").withPort(9042).build(); Metadata metadata = cluster.getMetadata(); List<KeyspaceMetadata> keyspaces = metadata.getKeyspaces(); for (KeyspaceMetadata keyspace : keyspaces) { Collection<TableMetadata> tables = keyspace.getTables(); for (TableMetadata table : tables) { String keyspaceName = keyspace.getName(); String packageName = CaseFormat.LOWER_UNDERSCORE.to(CaseFormat.UPPER_CAMEL, keyspaceName) .toLowerCase();//from w ww . j a v a 2s . c om String tableName = table.getName(); String className = "Q" + CaseFormat.LOWER_UNDERSCORE.to(CaseFormat.UPPER_CAMEL, tableName); File directory = new File("src/main/java/com/marvinformatics/test", packageName); directory.mkdirs(); File file = new File(directory, className + ".java"); file.delete(); try (PrintWriter pw = new PrintWriter(file);) { pw.println("package com.marvinformatics.test." + packageName + ";"); pw.println(); String variableName = CaseFormat.LOWER_UNDERSCORE.to(CaseFormat.LOWER_CAMEL, tableName); pw.println("@javax.annotation.Generated(\"HardcodedSchemaGenerator\")"); pw.println("public class " + className + " extends com.querydsl.core.types.dsl.BeanPath<" + className + "> {"); pw.println(); pw.println(" public static final " + className + " " + variableName + " = new " + className + "(\"" + variableName + "\");"); List<ColumnMetadata> columns = table.getColumns(); for (ColumnMetadata column : columns) { String columnName = column.getName(); String fieldName = CaseFormat.LOWER_UNDERSCORE.to(CaseFormat.LOWER_CAMEL, columnName); Optional<Class<? extends Path>> pathType = getPathType(column.getType()); if (pathType.isPresent()) { pw.println(); pw.println(" public final " + toString(pathType, column.getType()) + " " + fieldName + " = " + create(columnName, column.getType()) + ";"); } else { pw.println(); pw.println(" // public final " + column.getType() + " " + fieldName + " = null\");"); } } pw.println(" public " + className + "(String variable) {\n" + " super(" + className + ".class, variable);\n" + " }"); pw.println(); pw.println("}"); } } } cluster.close(); }
From source file:com.mysema.codegen.StringUtils.java
public static String capitalize(String str) { return CaseFormat.LOWER_CAMEL.to(CaseFormat.UPPER_CAMEL, str); }
From source file:com.mysema.codegen.StringUtils.java
public static String uncapitalize(String str) { return CaseFormat.UPPER_CAMEL.to(CaseFormat.LOWER_CAMEL, str); }
From source file:com.google.api.tools.framework.importers.swagger.NameConverter.java
static String operationIdToMethodName(String operationId) { return CaseFormat.LOWER_CAMEL.to(CaseFormat.UPPER_CAMEL, sanitizeStringValue(operationId)); }
From source file:com.google.api.tools.framework.importers.swagger.aspects.utils.NameConverter.java
public static String operationIdToMethodName(String operationId) { return CaseFormat.LOWER_CAMEL.to(CaseFormat.UPPER_CAMEL, sanitizeStringValue(operationId)); }
From source file:com.sebrichard.mfgen.MetaFieldUtil.java
public static String generateMetaFieldName(@NotNull String field) { return PREFIX + CaseFormat.LOWER_CAMEL.to(CaseFormat.UPPER_UNDERSCORE, field); }
From source file:org.jclouds.b2.domain.Action.java
public static Action fromValue(String symbol) { return Action.valueOf(CaseFormat.LOWER_CAMEL.to(CaseFormat.UPPER_UNDERSCORE, symbol)); }