List of usage examples for com.google.common.base CaseFormat UPPER_UNDERSCORE
CaseFormat UPPER_UNDERSCORE
To view the source code for com.google.common.base CaseFormat UPPER_UNDERSCORE.
Click Source Link
From source file:org.apache.calcite.jdbc.MetaImpl.java
static ColumnMetaData.StructType fieldMetaData(Class clazz) { final List<ColumnMetaData> list = new ArrayList<ColumnMetaData>(); for (Field field : clazz.getFields()) { if (Modifier.isPublic(field.getModifiers()) && !Modifier.isStatic(field.getModifiers())) { list.add(columnMetaData(CaseFormat.LOWER_CAMEL.to(CaseFormat.UPPER_UNDERSCORE, field.getName()), list.size() + 1, field.getType())); }/*from ww w . j ava 2 s . com*/ } return ColumnMetaData.struct(list); }
From source file:org.mule.tools.module.loader.JarLoader.java
protected final void populateIcon(final Map<Metadata.Icon, URL> icons, final Metadata.Icon icon, final Repository repository, final Class<?> moduleType, final Module module) { final Object annotation = Annotations.getAnnotation(moduleType, Annotations.ICONS_ANNOTATION_CLASS_NAME); final String path; if (annotation != null) { path = Reflections.invoke(annotation, CaseFormat.UPPER_UNDERSCORE.to(CaseFormat.LOWER_CAMEL, icon.name())); } else {//from www .jav a 2 s . c o m path = Reflections.staticGet(Classes.loadClass(Annotations.ICONS_ANNOTATION_CLASS_NAME), "GENERIC_" + icon.name()); } final String finalPath = String.format(path, module.getName()); final URL url = repository.getIconLocation(finalPath); if (url != null) { icons.put(icon, url); } }
From source file:com.facebook.buck.cxx.CxxGenruleDescription.java
@Override protected MacroHandler getMacroHandlerForParseTimeDeps() { ImmutableMap.Builder<String, MacroExpander> macros = ImmutableMap.builder(); macros.put("exe", new ExecutableMacroExpander()); macros.put("location", new LocationMacroExpander()); macros.put("location-platform", new LocationMacroExpander()); macros.put("platform-name", new StringExpander("")); macros.put("cc", new CxxPlatformParseTimeDepsExpander(cxxPlatforms)); macros.put("cxx", new CxxPlatformParseTimeDepsExpander(cxxPlatforms)); macros.put("cflags", new StringExpander("")); macros.put("cxxflags", new StringExpander("")); macros.put("cppflags", new ParseTimeDepsExpander(Filter.NONE)); macros.put("cxxppflags", new ParseTimeDepsExpander(Filter.NONE)); macros.put("solibs", new ParseTimeDepsExpander(Filter.NONE)); macros.put("ld", new CxxPlatformParseTimeDepsExpander(cxxPlatforms)); for (Linker.LinkableDepType style : Linker.LinkableDepType.values()) { for (Filter filter : Filter.values()) { macros.put(String.format("ldflags-%s%s", CaseFormat.UPPER_UNDERSCORE.to(CaseFormat.LOWER_HYPHEN, style.toString()), filter == Filter.PARAM ? "-filter" : ""), new ParseTimeDepsExpander(filter)); }//ww w.j a v a 2 s.c o m } return new MacroHandler(macros.build()); }
From source file:com.android.build.gradle.internal.pipeline.TransformTask.java
private static AndroidStudioStats.GradleTransformExecution.Type getTransformType( @NonNull Class<? extends Transform> taskClass) { String taskImpl = taskClass.getSimpleName(); if (taskImpl.endsWith("Transform")) { taskImpl = taskImpl.substring(0, taskImpl.length() - "Transform".length()); }/*from w w w . j a v a2 s . c om*/ String potentialExecutionTypeName = CaseFormat.LOWER_CAMEL.to(CaseFormat.UPPER_UNDERSCORE, taskImpl); try { return AndroidStudioStats.GradleTransformExecution.Type.valueOf(potentialExecutionTypeName); } catch (IllegalArgumentException ignored) { return AndroidStudioStats.GradleTransformExecution.Type.UNKNOWN_TRANSFORM_TYPE; } }
From source file:com.b2international.snowowl.snomed.datastore.request.rf2.exporter.Rf2RefSetExporter.java
private String getCombinedRefSetName() { switch (refSetType) { case CONCRETE_DATA_TYPE: return "ConcreteDomainReferenceSet"; case OWL_AXIOM: return "OWLAxiom"; case OWL_ONTOLOGY: return "OWLOntology"; case MRCM_DOMAIN: return "MRCMDomain"; case MRCM_ATTRIBUTE_DOMAIN: return "MRCMAttributeDomain"; case MRCM_ATTRIBUTE_RANGE: return "MRCMAttributeRange"; case MRCM_MODULE_SCOPE: return "MRCMModuleScope"; case ASSOCIATION: //$FALL-THROUGH$ case SIMPLE: //$FALL-THROUGH$ case QUERY: //$FALL-THROUGH$ case ATTRIBUTE_VALUE: //$FALL-THROUGH$ case EXTENDED_MAP: //$FALL-THROUGH$ case SIMPLE_MAP: //$FALL-THROUGH$ case SIMPLE_MAP_WITH_DESCRIPTION: //$FALL-THROUGH$ case COMPLEX_MAP: //$FALL-THROUGH$ case DESCRIPTION_TYPE: //$FALL-THROUGH$ case MODULE_DEPENDENCY: //$FALL-THROUGH$ case LANGUAGE: return CaseFormat.UPPER_UNDERSCORE.to(CaseFormat.UPPER_CAMEL, refSetType.name()); default:/* www . j av a 2 s.co m*/ throw new IllegalArgumentException("Unknown SNOMED CT reference set type: " + refSetType); } }
From source file:com.google.api.codegen.util.Name.java
/** Returns the identifier in upper-underscore format. */ public String toUpperUnderscore() { return toUnderscore(CaseFormat.UPPER_UNDERSCORE); }
From source file:com.google.cloud.Identity.java
/** * Converts a string to an {@code Identity}. Used primarily for converting protobuf-generated * policy identities to {@code Identity} objects. *///from w w w . j av a2s. c o m public static Identity valueOf(String identityStr) { String[] info = identityStr.split(":"); Type type = Type.valueOf(CaseFormat.LOWER_CAMEL.to(CaseFormat.UPPER_UNDERSCORE, info[0])); if (info.length == 1) { return new Identity(type, null); } else if (info.length == 2) { return new Identity(type, info[1]); } else { throw new IllegalArgumentException("Illegal identity string: \"" + identityStr + "\""); } }
From source file:com.google.cloud.Identity.java
/** * Returns the string value associated with the identity. Used primarily for converting from * {@code Identity} objects to strings for protobuf-generated policies. *///from w ww . ja v a2s .c o m public String strValue() { String protobufString = CaseFormat.UPPER_UNDERSCORE.to(CaseFormat.LOWER_CAMEL, type.toString()); if (value == null) { return protobufString; } else { return protobufString + ":" + value; } }
From source file:com.opengamma.basics.schedule.StubConvention.java
/** * Obtains the type from a unique name./* w w w . ja v a 2s .co m*/ * * @param uniqueName the unique name * @return the type * @throws IllegalArgumentException if the name is not known */ @FromString public static StubConvention of(String uniqueName) { ArgChecker.notNull(uniqueName, "uniqueName"); return valueOf(CaseFormat.UPPER_CAMEL.to(CaseFormat.UPPER_UNDERSCORE, uniqueName)); }
From source file:org.apache.brooklyn.entity.group.SshCommandMembershipTrackingPolicy.java
@SuppressWarnings("unchecked") public void execute(Entity target, String command, String type, String memberId) { if (Entities.isNoLongerManaged(target)) return;/*from w w w .j a v a 2 s . c o m*/ Lifecycle state = target.getAttribute(Attributes.SERVICE_STATE_ACTUAL); if (state == Lifecycle.STOPPING || state == Lifecycle.STOPPED) return; Collection<? extends Location> locations = Locations.getLocationsCheckingAncestors(target.getLocations(), target); Maybe<SshMachineLocation> machine = Machines.findUniqueMachineLocation(locations, SshMachineLocation.class); if (machine.isAbsentOrNull()) { LOG.debug("No machine available to execute command"); return; } LOG.info("Executing command on {}: {}", machine.get(), command); String executionDir = config().get(EXECUTION_DIR); String sshCommand = SshCommandSensor.makeCommandExecutingInDirectory(command, executionDir, (EntityInternal) target); // Set things from the entities defined shell environment, overriding with our config Map<String, Object> env = MutableMap.of(); env.putAll(MutableMap.copyOf(entity.config().get(BrooklynConfigKeys.SHELL_ENVIRONMENT))); env.putAll(MutableMap.copyOf(config().get(BrooklynConfigKeys.SHELL_ENVIRONMENT))); // Add variables describing this invocation env.put(EVENT_TYPE, type); env.put(MEMBER_ID, memberId); // Try to resolve the configuration in the env Map try { env = (Map<String, Object>) Tasks.resolveDeepValue(env, Object.class, ((EntityInternal) entity).getExecutionContext()); } catch (InterruptedException | ExecutionException e) { throw Exceptions.propagate(e); } // Execute the command with the serialized environment strings ShellEnvironmentSerializer serializer = new ShellEnvironmentSerializer(getManagementContext()); SshEffectorTasks.SshEffectorTaskFactory<String> task = SshEffectorTasks.ssh(sshCommand) .machine(machine.get()).requiringZeroAndReturningStdout() .summary("group-" + CaseFormat.UPPER_UNDERSCORE.to(CaseFormat.LOWER_HYPHEN, type)) .environmentVariables(serializer.serialize(env)); String output = DynamicTasks.submit(task.newTask(), target).getUnchecked(); LOG.trace("Command returned: {}", output); }