當前位置: 首頁>>代碼示例>>Java>>正文


Java StringUtils.getFilename方法代碼示例

本文整理匯總了Java中org.springframework.util.StringUtils.getFilename方法的典型用法代碼示例。如果您正苦於以下問題:Java StringUtils.getFilename方法的具體用法?Java StringUtils.getFilename怎麽用?Java StringUtils.getFilename使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.springframework.util.StringUtils的用法示例。


在下文中一共展示了StringUtils.getFilename方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: generate

import org.springframework.util.StringUtils; //導入方法依賴的package包/類
private void generate(Directory root, File pomFile) {
	String name = StringUtils.getFilename(pomFile.getName());
	String extension = StringUtils.getFilenameExtension(pomFile.getName());
	String prefix = name.substring(0, name.length() - extension.length() - 1);
	File[] files = pomFile.getParentFile().listFiles((f) -> include(f, prefix));
	MultiValueMap<File, MavenCoordinates> coordinates = new LinkedMultiValueMap<>();
	for (File file : files) {
		String rootPath = StringUtils.cleanPath(root.getFile().getPath());
		String relativePath = StringUtils.cleanPath(file.getPath())
				.substring(rootPath.length() + 1);
		coordinates.add(file.getParentFile(),
				MavenCoordinates.fromPath(relativePath));
	}
	coordinates.forEach(this::writeMetadata);
}
 
開發者ID:spring-io,項目名稱:artifactory-resource,代碼行數:16,代碼來源:MavenMetadataGenerator.java

示例2: determineImportsFor

import org.springframework.util.StringUtils; //導入方法依賴的package包/類
private String[] determineImportsFor(Map entries) {
	// get contained packages to do matching on the test hierarchy
	Collection containedPackages = jarCreator.getContainedPackages();
	Set cumulatedPackages = new LinkedHashSet();

	// make sure the collection package is valid
	boolean validPackageCollection = !containedPackages.isEmpty();

	boolean trace = logger.isTraceEnabled();

	for (Iterator iterator = entries.entrySet().iterator(); iterator.hasNext();) {
		Map.Entry entry = (Map.Entry) iterator.next();
		String resourceName = (String) entry.getKey();

		// filter out the test hierarchy
		if (resourceName.endsWith(ClassUtils.CLASS_FILE_SUFFIX)) {
			if (trace) {
				logger.trace("Analyze imports for test bundle resource " + resourceName);
               }
			String classFileName = StringUtils.getFilename(resourceName);
			String className = classFileName.substring(0, classFileName.length() - ClassUtils.CLASS_FILE_SUFFIX.length());
			String classPkg = resourceName.substring(0, resourceName.length() - classFileName.length()).replace('/', '.');

			if (classPkg.startsWith(".")) {
				classPkg = classPkg.substring(1);
               }

			if (classPkg.endsWith(".")) {
				classPkg = classPkg.substring(0, classPkg.length() - 1);
               }

			// if we don't have the package, add it
			if (validPackageCollection && StringUtils.hasText(classPkg) && !containedPackages.contains(classPkg)) {
			    if (trace) {
					logger.trace("Package [" + classPkg + "] is NOT part of the test archive; adding an import for it");
                   }
				cumulatedPackages.add(classPkg);
			}

			// otherwise parse the class byte-code
			else {
				if (trace) {
					logger.trace("Package [" + classPkg + "] is part of the test archive; parsing " + className + " bytecode to determine imports...");
                   }
				cumulatedPackages.addAll(determineImportsForClass(className, (Resource) entry.getValue()));
			}
		}
	}

	return (String[]) cumulatedPackages.toArray(new String[cumulatedPackages.size()]);
}
 
開發者ID:eclipse,項目名稱:gemini.blueprint,代碼行數:52,代碼來源:AbstractOnTheFlyBundleCreatorTests.java

示例3: getFilename

import org.springframework.util.StringUtils; //導入方法依賴的package包/類
/**
 * Returns the filename of this resources. This implementation returns the
 * name of the file that this bundle path resource refers to.
 * 
 * @return resource filename
 * @see org.springframework.util.StringUtils#getFilename(String)
 */
public String getFilename() {
	return StringUtils.getFilename(this.path);
}
 
開發者ID:eclipse,項目名稱:gemini.blueprint,代碼行數:11,代碼來源:OsgiBundleResource.java

示例4: getFilename

import org.springframework.util.StringUtils; //導入方法依賴的package包/類
/**
 * This implementation returns the name of the file that this ServletContext
 * resource refers to.
 * @see org.springframework.util.StringUtils#getFilename(String)
 */
@Override
public String getFilename() {
	return StringUtils.getFilename(this.path);
}
 
開發者ID:lamsfoundation,項目名稱:lams,代碼行數:10,代碼來源:ServletContextResource.java


注:本文中的org.springframework.util.StringUtils.getFilename方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。