当前位置: 首页>>代码示例>>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;未经允许,请勿转载。