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.trinity.foundation.api.render.binding.BinderImpl.java
protected String toGetterMethodName(final String prefix, final String propertyName) { checkNotNull(prefix);/*from w w w. j a v a 2s .com*/ checkNotNull(propertyName); return prefix + CaseFormat.LOWER_CAMEL.to(CaseFormat.UPPER_CAMEL, propertyName); }
From source file:com.google.javascript.jscomp.JsMessageVisitor.java
/** * Converts the given string from upper-underscore case to lower-camel case, * preserving numeric suffixes. For example: "NAME" -> "name" "A4_LETTER" -> * "a4Letter" "START_SPAN_1_23" -> "startSpan_1_23". *//* w ww. jav a 2s.com*/ static String toLowerCamelCaseWithNumericSuffixes(String input) { // Determine where the numeric suffixes begin int suffixStart = input.length(); while (suffixStart > 0) { char ch = '\0'; int numberStart = suffixStart; while (numberStart > 0) { ch = input.charAt(numberStart - 1); if (Character.isDigit(ch)) { numberStart--; } else { break; } } if ((numberStart > 0) && (numberStart < suffixStart) && (ch == '_')) { suffixStart = numberStart - 1; } else { break; } } if (suffixStart == input.length()) { return CaseFormat.UPPER_UNDERSCORE.to(CaseFormat.LOWER_CAMEL, input); } else { return CaseFormat.UPPER_UNDERSCORE.to(CaseFormat.LOWER_CAMEL, input.substring(0, suffixStart)) + input.substring(suffixStart); } }
From source file:org.apache.brooklyn.util.core.task.BasicExecutionManager.java
/** invoked in a task's thread when a task is starting to run (may be some time after submitted), * but before doing any of the task's work, so that we can update bookkeeping and notify callbacks */ protected void internalBeforeStart(Map<?, ?> flags, Task<?> task) { activeTaskCount.incrementAndGet();/* w w w . ja v a 2 s.c o m*/ //set thread _before_ start time, so we won't get a null thread when there is a start-time if (log.isTraceEnabled()) log.trace("" + this + " beforeStart, task: " + task); if (!task.isCancelled()) { Thread thread = Thread.currentThread(); ((TaskInternal<?>) task).setThread(thread); if (RENAME_THREADS) { threadOriginalName.set(thread.getName()); String newThreadName = "brooklyn-" + CaseFormat.LOWER_HYPHEN.to(CaseFormat.LOWER_CAMEL, task.getDisplayName().replace(" ", "")) + "-" + task.getId().substring(0, 8); thread.setName(newThreadName); } PerThreadCurrentTaskHolder.perThreadCurrentTask.set(task); ((TaskInternal<?>) task).setStartTimeUtc(System.currentTimeMillis()); } invokeCallback(flags.get("newTaskStartCallback"), task); }
From source file:com.tactfactory.harmony.platform.android.AndroidProjectAdapter.java
@Override public List<IUpdater> getApplicationFiles() { List<IUpdater> result = new ArrayList<IUpdater>(); String applicationName = CaseFormat.LOWER_CAMEL.to(CaseFormat.UPPER_CAMEL, this.adapter.getApplicationMetadata().getName()); String templatePath = this.adapter.getTemplateSourcePath(); String filePath = String.format("%s%s/", this.adapter.getSourcePath(), this.adapter.getApplicationMetadata().getProjectNameSpace()); //Create base classes for Fixtures loaders result.add(new SourceFile(templatePath + "TemplateApplicationBase.java", filePath + applicationName + "ApplicationBase.java", true)); result.add(new SourceFile(templatePath + "TemplateApplication.java", filePath + applicationName + "Application.java")); return result; }
From source file:org.apache.abdera2.activities.extra.Extra.java
static String get_name(Method obj) { String name = null;//from w w w .j ava 2s. c o m if (obj.isAnnotationPresent(Name.class)) name = obj.getAnnotation(Name.class).value(); else { name = obj.getName(); if (name.startsWith("get") || name.startsWith("set")) name = name.substring(3); name = CaseFormat.UPPER_CAMEL.to(CaseFormat.LOWER_CAMEL, name); } return name; }
From source file:com.tactfactory.harmony.platform.android.AndroidProjectAdapter.java
@Override public List<IUpdater> getProviderFiles() { List<IUpdater> result = new ArrayList<IUpdater>(); String nameProvider = CaseFormat.LOWER_CAMEL.to(CaseFormat.UPPER_CAMEL, this.adapter.getApplicationMetadata().getName() + "Provider"); String templatePath = this.adapter.getTemplateSourceProviderPath(); String filePath = String.format("%s%s/%s/", this.adapter.getSourcePath(), this.adapter.getApplicationMetadata().getProjectNameSpace(), this.adapter.getProvider()); result.add(new SourceFile(templatePath + "utils/base/ApplicationProviderUtilsBase.java", filePath + "utils/base/ProviderUtilsBase.java", true)); result.add(new SourceFile(templatePath + "utils/ApplicationProviderUtils.java", filePath + "utils/ProviderUtils.java", false)); result.add(new SourceFile(templatePath + "TemplateProvider.java", filePath + nameProvider + ".java")); result.add(new SourceFile(templatePath + "base/TemplateProviderBase.java", filePath + "base/" + nameProvider + "Base.java", true)); result.add(new SourceFile(templatePath + "base/ProviderAdapterBase.java", filePath + "base/ProviderAdapterBase.java", true)); result.add(new SourceFile(templatePath + "ProviderAdapter.java", filePath + "ProviderAdapter.java", false)); // Package infos result.add(new SourceFile(templatePath + "provider-package-info.java", filePath + "package-info.java")); result.add(new SourceFile(templatePath + "base/provider-package-info.java", filePath + "base/package-info.java")); result.add(new SourceFile(templatePath + "utils/base/package-info.java", filePath + "utils/base/package-info.java")); result.add(new SourceFile(templatePath + "utils/package-info.java", filePath + "utils/package-info.java")); String providerNamespace = this.adapter.getApplicationMetadata().getProjectNameSpace().replace('/', '.') + "." + this.adapter.getProvider(); result.add(new ManifestProviderAndroid(this.adapter, providerNamespace, nameProvider)); return result; }
From source file:com.google.gwt.resources.rg.GssResourceGenerator.java
/** * Transform a camel case string to upper case. Each word is separated by a '_' * * @param camelCase//from ww w . j av a 2 s . c o m * @return */ private String toUpperCase(String camelCase) { return CaseFormat.LOWER_CAMEL.to(CaseFormat.UPPER_UNDERSCORE, camelCase); }
From source file:com.tactfactory.harmony.platform.android.AndroidProjectAdapter.java
@Override public List<IUpdater> getMenuFiles() { List<IUpdater> result = new ArrayList<IUpdater>(); String cappedProjectName = CaseFormat.LOWER_CAMEL.to(CaseFormat.UPPER_CAMEL, this.adapter.getApplicationMetadata().getName()); String templatePath = this.adapter.getTemplateMenuBasePath(); String filePath = this.adapter.getMenuBasePath(); // create MenuWrapper result.add(new SourceFile(templatePath + "MenuWrapperBase.java", filePath + "MenuWrapperBase.java", true)); // Package infos result.add(new SourceFile(templatePath + "package-info.java", filePath + "package-info.java", false)); templatePath = this.adapter.getTemplateMenuPath(); filePath = this.adapter.getMenuPath(); // create ProjectMenu result.add(new SourceFile(templatePath + "TemplateMenu.java", String.format("%s%sMenu.java", filePath, cappedProjectName), false)); result.add(new SourceFile(templatePath + "package-info.java", filePath + "package-info.java", false)); return result; }
From source file:com.tactfactory.harmony.platform.android.AndroidProjectAdapter.java
@Override public List<IUpdater> getMenuBaseFiles() { List<IUpdater> result = new ArrayList<IUpdater>(); String cappedProjectName = CaseFormat.LOWER_CAMEL.to(CaseFormat.UPPER_CAMEL, this.adapter.getApplicationMetadata().getName()); String templatePath = this.adapter.getTemplateMenuBasePath(); String filePath = this.adapter.getMenuBasePath(); // create ProjectMenuBase result.add(new SourceFile(templatePath + "TemplateMenuBase.java", String.format("%s%sMenuBase.java", filePath, cappedProjectName), true)); return result; }
From source file:dagger2.internal.codegen.ComponentGenerator.java
private FrameworkField frameworkFieldForResolvedBindings(ResolvedBindings resolvedBindings) { BindingKey bindingKey = resolvedBindings.bindingKey(); switch (bindingKey.kind()) { case CONTRIBUTION: ImmutableSet<? extends ContributionBinding> contributionBindings = resolvedBindings .contributionBindings(); BindingType bindingsType = ProvisionBinding.bindingTypeFor(contributionBindings); switch (bindingsType) { case SET: case MAP: return FrameworkField.createWithTypeFromKey(frameworkClassForResolvedBindings(resolvedBindings), bindingKey, KeyVariableNamer.INSTANCE.apply(bindingKey.key())); case UNIQUE: ContributionBinding binding = Iterables.getOnlyElement(contributionBindings); return FrameworkField.createWithTypeFromKey(frameworkClassForResolvedBindings(resolvedBindings), bindingKey, binding.bindingElement().accept(new ElementKindVisitor6<String, Void>() { @Override public String visitExecutableAsConstructor(ExecutableElement e, Void p) { return e.getEnclosingElement().accept(this, null); }/*from w w w . j a v a 2s. com*/ @Override public String visitExecutableAsMethod(ExecutableElement e, Void p) { return e.getSimpleName().toString(); } @Override public String visitType(TypeElement e, Void p) { return CaseFormat.UPPER_CAMEL.to(CaseFormat.LOWER_CAMEL, e.getSimpleName().toString()); } }, null)); default: throw new AssertionError(); } case MEMBERS_INJECTION: return FrameworkField.createWithTypeFromKey(MembersInjector.class, bindingKey, CaseFormat.UPPER_CAMEL.to(CaseFormat.LOWER_CAMEL, Iterables.getOnlyElement(resolvedBindings.bindings()).bindingElement().getSimpleName() .toString())); default: throw new AssertionError(); } }