本文整理汇总了Java中org.gradle.util.CollectionUtils.join方法的典型用法代码示例。如果您正苦于以下问题:Java CollectionUtils.join方法的具体用法?Java CollectionUtils.join怎么用?Java CollectionUtils.join使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.gradle.util.CollectionUtils
的用法示例。
在下文中一共展示了CollectionUtils.join方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: resolveAsRelativePath
import org.gradle.util.CollectionUtils; //导入方法依赖的package包/类
public String resolveAsRelativePath(Object path) {
List<String> basePath = Arrays.asList(StringUtils.split(baseDir.getAbsolutePath(), "/" + File.separator));
File targetFile = resolve(path);
List<String> targetPath = new ArrayList<String>(Arrays.asList(StringUtils.split(targetFile.getAbsolutePath(),
"/" + File.separator)));
// Find and remove common prefix
int maxDepth = Math.min(basePath.size(), targetPath.size());
int prefixLen = 0;
while (prefixLen < maxDepth && basePath.get(prefixLen).equals(targetPath.get(prefixLen))) {
prefixLen++;
}
basePath = basePath.subList(prefixLen, basePath.size());
targetPath = targetPath.subList(prefixLen, targetPath.size());
for (int i = 0; i < basePath.size(); i++) {
targetPath.add(0, "..");
}
if (targetPath.isEmpty()) {
return ".";
}
return CollectionUtils.join(File.separator, targetPath);
}
示例2: formatMessage
import org.gradle.util.CollectionUtils; //导入方法依赖的package包/类
private String formatMessage(String title, String message) {
final File icon = iconProvider.getIcon(32, 32);
List<String> properties = Arrays.asList(
formatProperty("action", "notification"),
formatProperty("app", "Gradle Snarl Notifier"),
formatProperty("class", "alert"),
formatProperty("title", title),
formatProperty("text", message),
formatProperty("icon", icon == null ? null : icon.getAbsolutePath()),
formatProperty("timeout", "10"));
return HEAD + CollectionUtils.join("", properties) + "\r\n";
}
示例3: toString
import org.gradle.util.CollectionUtils; //导入方法依赖的package包/类
@Override
public String toString() {
return "{"
+ "dir: '" + getProjectDir().getAbsolutePath() + "'"
+ ", tasks: '" + CollectionUtils.join(" ", getTasks()) + "'"
+ ", arguments: '" + CollectionUtils.join(" ", getArguments()) + "'"
+ ", gradleVersion: " + getGradleVersion()
+ "}";
}
示例4: createTemporaryFile
import org.gradle.util.CollectionUtils; //导入方法依赖的package包/类
public File createTemporaryFile(String prefix, @Nullable String suffix, String... path) {
File dir = new File(baseDirFactory.create(), CollectionUtils.join("/", path));
GFileUtils.mkdirs(dir);
try {
return File.createTempFile(prefix, suffix, dir);
} catch (IOException e) {
throw new UncheckedIOException(e);
}
}
示例5: createTemporaryDirectory
import org.gradle.util.CollectionUtils; //导入方法依赖的package包/类
public File createTemporaryDirectory(@Nullable String prefix, @Nullable String suffix, @Nullable String... path) {
File dir = new File(baseDirFactory.create(), CollectionUtils.join("/", path));
GFileUtils.mkdirs(dir);
try {
// TODO: This is not a great paradigm for creating a temporary directory.
// See http://guava-libraries.googlecode.com/svn/tags/release08/javadoc/com/google/common/io/Files.html#createTempDir%28%29 for an alternative.
File tmpDir = File.createTempFile("gradle", "projectDir", dir);
tmpDir.delete();
tmpDir.mkdir();
return tmpDir;
} catch (IOException e) {
throw new UncheckedIOException(e);
}
}
示例6: createManifestClasspath
import org.gradle.util.CollectionUtils; //导入方法依赖的package包/类
public static String createManifestClasspath(File jarFile, Collection<File> classpath) {
List<String> paths = new ArrayList<String>(classpath.size());
for (File file : classpath) {
String path = constructRelativeClasspathUri(jarFile, file);
paths.add(path);
}
return CollectionUtils.join(" ", paths);
}
示例7: assertCompatibleCacheParameters
import org.gradle.util.CollectionUtils; //导入方法依赖的package包/类
void assertCompatibleCacheParameters(PersistentIndexedCacheParameters parameters) {
List<String> faultMessages = new ArrayList<String>();
checkCacheNameMatch(faultMessages, parameters.getCacheName());
checkCompatibleKeySerializer(faultMessages, parameters.getKeySerializer());
checkCompatibleValueSerializer(faultMessages, parameters.getValueSerializer());
checkCompatibleCacheDecorator(faultMessages, parameters.getCacheDecorator());
if (!faultMessages.isEmpty()) {
String lineSeparator = SystemProperties.getInstance().getLineSeparator();
String faultMessage = CollectionUtils.join(lineSeparator, faultMessages);
throw new InvalidCacheReuseException(
"The cache couldn't be reused because of the following mismatch:" + lineSeparator + faultMessage);
}
}
示例8: createPropertyStringFromList
import org.gradle.util.CollectionUtils; //导入方法依赖的package包/类
private String createPropertyStringFromList(List<String> valueList) {
return valueList == null || valueList.isEmpty() ? null : CollectionUtils.join(",", valueList);
}