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:net.centro.rtb.monitoringcenter.metrics.system.jvm.ThreadMetricSet.java
ThreadMetricSet() { this.threadMXBean = ManagementFactory.getThreadMXBean(); this.deadlockDetector = new ThreadDeadlockDetector(); Map<String, Metric> metricsByNames = new HashMap<>(); this.currentThreadsGauge = new Gauge<Integer>() { @Override/* w w w . j av a 2 s .c o m*/ public Integer getValue() { return threadMXBean.getThreadCount(); } }; metricsByNames.put("currentCount", currentThreadsGauge); this.peakThreadsGauge = new Gauge<Integer>() { @Override public Integer getValue() { return threadMXBean.getPeakThreadCount(); } }; metricsByNames.put("peakCount", peakThreadsGauge); this.daemonThreadsGauge = new Gauge<Integer>() { @Override public Integer getValue() { return threadMXBean.getPeakThreadCount(); } }; metricsByNames.put("daemons", daemonThreadsGauge); this.deadlockedThreadsGauge = new Gauge<Integer>() { @Override public Integer getValue() { return deadlockDetector.getDeadlockedThreads().size(); } }; metricsByNames.put("deadlocked", deadlockedThreadsGauge); Map<Thread.State, Gauge<Integer>> threadsGaugesByThreadStates = new HashMap<>(); for (final Thread.State state : Thread.State.values()) { String metricName = CaseFormat.UPPER_UNDERSCORE.to(CaseFormat.LOWER_CAMEL, state.toString()); Gauge<Integer> threadsGauge = new Gauge<Integer>() { @Override public Integer getValue() { return getThreadCount(state); } }; threadsGaugesByThreadStates.put(state, threadsGauge); metricsByNames.put(metricName, threadsGauge); } this.threadsGaugesByThreadStates = threadsGaugesByThreadStates; this.metricsByNames = metricsByNames; }
From source file:com.axelor.common.Inflector.java
/** * Convert the given word to camel case. * /*from ww w. ja v a2 s . c o m*/ * <pre> * inflection.camelcase("address_book", false); // "AddressBook" * inflection.camelcase("address-book", true); // "addressBook" * inflection.camelcase("Address book", false); // "AddressBook" * </pre> * * @param word * the word to convert * @param lower * whether to create lower camel case * @return camel case string */ public String camelize(String word, boolean lower) { final CaseFormat target = lower ? CaseFormat.LOWER_CAMEL : CaseFormat.UPPER_CAMEL; return CaseFormat.LOWER_UNDERSCORE.to(target, underscore(word)); }
From source file:net.simonvt.schematic.compiler.DatabaseWriter.java
public DatabaseWriter(ProcessingEnvironment env, Elements elements, Element database) { this.processingEnv = env; this.elementUtils = env.getElementUtils(); this.database = database; String databaseSchematicName = database.getSimpleName().toString(); Database db = database.getAnnotation(Database.class); this.version = db.version(); this.className = db.className(); if (className.trim().isEmpty()) { this.className = databaseSchematicName; }/*from www. j a va2 s . com*/ this.outPackage = db.packageName(); if (outPackage.trim().isEmpty()) { this.outPackage = elements.getPackageOf(database).getQualifiedName() + ".generated"; } this.fileName = db.fileName(); if (fileName.trim().isEmpty()) { this.fileName = CaseFormat.UPPER_CAMEL.to(CaseFormat.LOWER_CAMEL, databaseSchematicName) + ".db"; } clazzName = ClassName.get(outPackage, className); findAnnotations(database); }
From source file:com.google.template.soy.basicdirectives.BasicEscapeDirective.java
@Override public PyExpr applyForPySrc(PyExpr value, List<PyExpr> args) { String pyFnName = CaseFormat.LOWER_CAMEL.to(CaseFormat.LOWER_UNDERSCORE, name.substring(1)); return new PyExpr("sanitize." + pyFnName + "(" + value.getText() + ")", Integer.MAX_VALUE); }
From source file:com.thinkbiganalytics.nifi.provenance.util.SpringApplicationContext.java
/** * get a Spring bean by the Class type/*from www . j av a2s .c o m*/ */ public <T> T getBean(Class<T> requiredType) throws BeansException { T bean = null; try { bean = this.applicationContext.getBean(requiredType); } catch (Exception e) { //try to find it by the name String name = requiredType.getSimpleName(); name = CaseFormat.UPPER_CAMEL.to(CaseFormat.LOWER_CAMEL, name); bean = (T) getBean(name); } return bean; }
From source file:com.spotify.hamcrest.pojo.IsPojo.java
public IsPojo<A> withProperty(String property, Matcher<?> valueMatcher) { return where("get" + CaseFormat.LOWER_CAMEL.to(CaseFormat.UPPER_CAMEL, property), valueMatcher); }
From source file:cn.patterncat.metrics.jvm.ThreadMetricSet.java
ThreadMetricSet() { this.threadMXBean = ManagementFactory.getThreadMXBean(); this.deadlockDetector = new ThreadDeadlockDetector(); Map<String, Metric> metricsByNames = new HashMap<>(); this.currentThreadsGauge = new Gauge<Integer>() { @Override//from ww w . j av a 2s .co m public Integer getValue() { return threadMXBean.getThreadCount(); } }; metricsByNames.put("currentCount", currentThreadsGauge); this.peakThreadsGauge = new Gauge<Integer>() { @Override public Integer getValue() { return threadMXBean.getPeakThreadCount(); } }; metricsByNames.put("peakCount", peakThreadsGauge); this.daemonThreadsGauge = new Gauge<Integer>() { @Override public Integer getValue() { return threadMXBean.getDaemonThreadCount(); } }; metricsByNames.put("daemonCount", daemonThreadsGauge); this.deadlockedThreadsGauge = new Gauge<Integer>() { @Override public Integer getValue() { return deadlockDetector.getDeadlockedThreads().size(); } }; metricsByNames.put("deadlockCount", deadlockedThreadsGauge); Map<Thread.State, Gauge<Integer>> threadsGaugesByThreadStates = new HashMap<>(); for (final Thread.State state : Thread.State.values()) { String metricName = CaseFormat.UPPER_UNDERSCORE.to(CaseFormat.LOWER_CAMEL, state.toString()); Gauge<Integer> threadsGauge = new Gauge<Integer>() { @Override public Integer getValue() { return getThreadCount(state); } }; threadsGaugesByThreadStates.put(state, threadsGauge); metricsByNames.put(metricName, threadsGauge); } this.threadsGaugesByThreadStates = threadsGaugesByThreadStates; this.metricsByNames = metricsByNames; }
From source file:com.axelor.meta.schema.views.AbstractWidget.java
@XmlTransient public Map<String, Object> getWidgetAttrs() { if (otherAttributes == null || otherAttributes.isEmpty()) { return null; }//from w w w.ja v a 2 s . co m final Map<String, Object> attrs = Maps.newHashMap(); for (QName qn : otherAttributes.keySet()) { String name = qn.getLocalPart(); String value = otherAttributes.get(qn); if (name.startsWith("x-") || name.startsWith("data-")) { name = name.replaceFirst("^(x|data)-", ""); name = CaseFormat.LOWER_HYPHEN.to(CaseFormat.LOWER_CAMEL, name); attrs.put(name, value); } } if (attrs.containsKey("target") && !attrs.containsKey("targetName")) { try { Class<?> target = ClassUtils.findClass(attrs.get("target").toString()); String targetName = Mapper.of(target).getNameField().getName(); attrs.put("targetName", targetName); } catch (Exception e) { } } return attrs; }
From source file:dagger.internal.codegen.DependencyVariableNamer.java
private String toLowerCamel(String name) { return CaseFormat.UPPER_CAMEL.to(CaseFormat.LOWER_CAMEL, name); }
From source file:ratpack.config.internal.source.EnvironmentConfigSource.java
public static Function<String, String> camelCase() { return Function.fromGuava(CaseFormat.UPPER_UNDERSCORE.converterTo(CaseFormat.LOWER_CAMEL)); }