本文整理汇总了Java中org.codehaus.groovy.runtime.StringGroovyMethods.capitalize方法的典型用法代码示例。如果您正苦于以下问题:Java StringGroovyMethods.capitalize方法的具体用法?Java StringGroovyMethods.capitalize怎么用?Java StringGroovyMethods.capitalize使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.codehaus.groovy.runtime.StringGroovyMethods
的用法示例。
在下文中一共展示了StringGroovyMethods.capitalize方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: addInstallTask
import org.codehaus.groovy.runtime.StringGroovyMethods; //导入方法依赖的package包/类
private void addInstallTask(final Project project, final Distribution distribution) {
String taskName = TASK_INSTALL_NAME;
if (!MAIN_DISTRIBUTION_NAME.equals(distribution.getName())) {
taskName = "install" + StringGroovyMethods.capitalize(distribution.getName()) + "Dist";
}
Sync installTask = project.getTasks().create(taskName, Sync.class);
installTask.setDescription("Installs the project as a distribution as-is.");
installTask.setGroup(DISTRIBUTION_GROUP);
installTask.with(distribution.getContents());
installTask.into(new Callable<File>() {
@Override
public File call() throws Exception {
return project.file("" + project.getBuildDir() + "/install/" + distribution.getBaseName());
}
});
}
示例2: addAssembleTask
import org.codehaus.groovy.runtime.StringGroovyMethods; //导入方法依赖的package包/类
private void addAssembleTask(Project project, Distribution distribution, Task... tasks) {
String taskName = TASK_ASSEMBLE_NAME;
if (!MAIN_DISTRIBUTION_NAME.equals(distribution.getName())) {
taskName = "assemble" + StringGroovyMethods.capitalize(distribution.getName()) + "Dist";
}
Task assembleTask = project.getTasks().create(taskName);
assembleTask.setDescription("Assembles the " + distribution.getName() + " distributions");
assembleTask.setGroup(DISTRIBUTION_GROUP);
assembleTask.dependsOn((Object[]) tasks);
}
示例3: createComparatorFor
import org.codehaus.groovy.runtime.StringGroovyMethods; //导入方法依赖的package包/类
private static void createComparatorFor(ClassNode classNode, PropertyNode property, boolean reversed) {
String propName = StringGroovyMethods.capitalize((CharSequence) property.getName());
String className = classNode.getName() + "$" + propName + "Comparator";
ClassNode superClass = makeClassSafeWithGenerics(AbstractComparator.class, classNode);
InnerClassNode cmpClass = new InnerClassNode(classNode, className, ACC_PRIVATE | ACC_STATIC, superClass);
classNode.getModule().addClass(cmpClass);
cmpClass.addMethod(new MethodNode(
"compare",
ACC_PUBLIC,
ClassHelper.int_TYPE,
params(param(newClass(classNode), ARG0), param(newClass(classNode), ARG1)),
ClassNode.EMPTY_ARRAY,
createCompareMethodBody(property, reversed)
));
String fieldName = "this$" + propName + "Comparator";
// private final Comparator this$<property>Comparator = new <type>$<property>Comparator();
FieldNode cmpField = classNode.addField(
fieldName,
ACC_STATIC | ACC_FINAL | ACC_PRIVATE | ACC_SYNTHETIC,
COMPARATOR_TYPE,
ctorX(cmpClass));
classNode.addMethod(new MethodNode(
"comparatorBy" + propName,
ACC_PUBLIC | ACC_STATIC,
COMPARATOR_TYPE,
Parameter.EMPTY_ARRAY,
ClassNode.EMPTY_ARRAY,
returnS(fieldX(cmpField))
));
}
示例4: configureOverlay
import org.codehaus.groovy.runtime.StringGroovyMethods; //导入方法依赖的package包/类
private void configureOverlay(WarOverlay overlay, ExternalDependency dependency) {
War warTask = overlay.getWarTask();
String capitalizedWarTaskName = StringGroovyMethods.capitalize((CharSequence) warTask.getName());
String capitalizedOverlayName = StringGroovyMethods.capitalize((CharSequence) overlay.getName());
dependency.setTransitive(false);
Configuration configuration = project.getConfigurations().create(overlay.getConfigurationName());
configuration.setDescription(String.format("Contents of the overlay '%s' for the task '%s'.", overlay.getName(), warTask.getName()));
configuration.getDependencies().add(dependency);
File destinationDir = new File(project.getBuildDir(), String.format("overlays/%s/%s", warTask.getName(), overlay.getName()));
Action<CopySpec> extractOverlay = copySpec -> {
copySpec.into(destinationDir);
copySpec.from((Callable<FileTree>) () -> project.zipTree(configuration.getSingleFile()));
};
Sync extractOverlayTask = project.getTasks().create(String.format("extract%s%sOverlay", capitalizedOverlayName, capitalizedWarTaskName), Sync.class, extractOverlay);
overlay.getWarCopySpec().from(extractOverlayTask);
if (overlay.isEnableCompilation()) {
project.sync(extractOverlay);
project.getTasks().getByName(CLEAN_TASK_NAME).finalizedBy(extractOverlayTask);
ConfigurableFileCollection classes = project.files(new File(destinationDir, "WEB-INF/classes"))
.builtBy(extractOverlayTask);
project.getDependencies().add(COMPILE_CLASSPATH_CONFIGURATION_NAME, classes);
project.getDependencies().add(TEST_COMPILE_CLASSPATH_CONFIGURATION_NAME, classes);
FileTree libs = project.files(extractOverlayTask).builtBy(extractOverlayTask).getAsFileTree()
.matching(patternFilterable -> patternFilterable.include("WEB-INF/lib/**"));
project.getDependencies().add(COMPILE_CLASSPATH_CONFIGURATION_NAME, libs);
project.getDependencies().add(TEST_COMPILE_CLASSPATH_CONFIGURATION_NAME, libs);
}
}