本文整理汇总了Java中org.springframework.roo.project.maven.Pom.getPhysicalPaths方法的典型用法代码示例。如果您正苦于以下问题:Java Pom.getPhysicalPaths方法的具体用法?Java Pom.getPhysicalPaths怎么用?Java Pom.getPhysicalPaths使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.springframework.roo.project.maven.Pom
的用法示例。
在下文中一共展示了Pom.getPhysicalPaths方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getPhysicalPath
import org.springframework.roo.project.maven.Pom; //导入方法依赖的package包/类
private PhysicalPath getPhysicalPath(final JavaType javaType) {
Validate.notNull(javaType, "Java type required");
final String parentPath = getParentPath(javaType);
if (parentPath == null) {
return null;
}
for (final Pom pom : getProjectOperations().getPoms()) {
for (final PhysicalPath physicalPath : pom.getPhysicalPaths()) {
if (physicalPath.isSource()) {
final String pathLocation = FileUtils
.ensureTrailingSeparator(physicalPath
.getLocationPath());
if (pathLocation.startsWith(parentPath)) {
getTypeCache().cacheTypeAgainstModule(pom, javaType);
return physicalPath;
}
}
}
}
return null;
}
示例2: getApplicablePhysicalPath
import org.springframework.roo.project.maven.Pom; //导入方法依赖的package包/类
/**
* Locates the first {@link PhysicalPath} which can be construed as a parent
* of the presented identifier.
*
* @param identifier to locate the parent of (required)
* @return the first matching parent, or null if not found
*/
@Override
protected PhysicalPath getApplicablePhysicalPath(final String identifier) {
Validate.notNull(identifier, "Identifier required");
PhysicalPath physicalPath = null;
int longest = 0;
for (final Pom pom : pomManagementService.getPoms()) {
if (removeTrailingSeparator(identifier).startsWith(
removeTrailingSeparator(pom.getRoot()))
&& removeTrailingSeparator(pom.getRoot()).length() > longest) {
longest = removeTrailingSeparator(pom.getRoot()).length();
int nextLongest = 0;
for (final PhysicalPath thisPhysicalPath : pom
.getPhysicalPaths()) {
final String possibleParent = new FileDetails(
thisPhysicalPath.getLocation(), null)
.getCanonicalPath();
if (removeTrailingSeparator(identifier).startsWith(
possibleParent)
&& possibleParent.length() > nextLongest) {
nextLongest = possibleParent.length();
physicalPath = thisPhysicalPath;
}
}
}
}
return physicalPath;
}
示例3: getPaths
import org.springframework.roo.project.maven.Pom; //导入方法依赖的package包/类
@Override
protected Collection<LogicalPath> getPaths(final boolean sourceOnly) {
final Collection<LogicalPath> pathIds = new ArrayList<LogicalPath>();
for (final Pom pom : pomManagementService.getPoms()) {
for (final PhysicalPath modulePath : pom.getPhysicalPaths()) {
if (!sourceOnly || modulePath.isSource()) {
pathIds.add(modulePath.getLogicalPath());
}
}
}
return pathIds;
}
示例4: getProposedJavaType
import org.springframework.roo.project.maven.Pom; //导入方法依赖的package包/类
private String getProposedJavaType(final String fileCanonicalPath) {
Validate.notBlank(fileCanonicalPath, "File canonical path required");
// Determine the JavaType for this file
String relativePath = "";
final Pom moduleForFileIdentifier = getProjectOperations()
.getModuleForFileIdentifier(fileCanonicalPath);
if (moduleForFileIdentifier == null) {
return relativePath;
}
for (final PhysicalPath physicalPath : moduleForFileIdentifier
.getPhysicalPaths()) {
final String moduleCanonicalPath = FileUtils
.ensureTrailingSeparator(FileUtils
.getCanonicalPath(physicalPath.getLocation()));
if (fileCanonicalPath.startsWith(moduleCanonicalPath)) {
relativePath = File.separator
+ StringUtils.replace(fileCanonicalPath,
moduleCanonicalPath, "", 1);
break;
}
}
Validate.notBlank(relativePath,
"Could not determine compilation unit name for file '%s'",
fileCanonicalPath);
Validate.isTrue(
relativePath.startsWith(File.separator),
"Relative path unexpectedly dropped the '%s' prefix (received '%s' from '%s')",
File.separator, relativePath, fileCanonicalPath);
relativePath = relativePath.substring(1);
Validate.isTrue(
relativePath.endsWith(".java"),
"The relative path unexpectedly dropped the .java extension for file '%s'",
fileCanonicalPath);
relativePath = relativePath.substring(0,
relativePath.lastIndexOf(".java"));
return relativePath.replace(File.separatorChar, '.');
}
示例5: initTypeMap
import org.springframework.roo.project.maven.Pom; //导入方法依赖的package包/类
private void initTypeMap() {
for (final Pom pom : getProjectOperations().getPoms()) {
for (final PhysicalPath path : pom.getPhysicalPaths()) {
if (path.isSource()) {
final String allJavaFiles = FileUtils
.ensureTrailingSeparator(path.getLocationPath())
+ JAVA_FILES_ANT_PATH;
for (final FileDetails file : getFileManager()
.findMatchingAntPath(allJavaFiles)) {
cacheType(file.getCanonicalPath());
}
}
}
}
}
示例6: getAllPossibleValues
import org.springframework.roo.project.maven.Pom; //导入方法依赖的package包/类
public boolean getAllPossibleValues(final List<Completion> completions,
final Class<?> targetType, final String existingData,
final String optionContext, final MethodTarget target) {
for (final Pom pom : projectOperations.getPoms()) {
for (final PhysicalPath physicalPath : pom.getPhysicalPaths()) {
completions.add(new Completion(physicalPath.getLogicalPath()
.getName()));
}
}
return false;
}
示例7: getPhysicalTypeIdentifier
import org.springframework.roo.project.maven.Pom; //导入方法依赖的package包/类
public String getPhysicalTypeIdentifier(final String fileCanonicalPath) {
Validate.notBlank(fileCanonicalPath, "File canonical path required");
if (!doesPathIndicateJavaType(fileCanonicalPath)) {
return null;
}
String physicalTypeIdentifier = getTypeCache()
.getTypeIdFromTypeFilePath(fileCanonicalPath);
if (physicalTypeIdentifier != null) {
return physicalTypeIdentifier;
}
final String typeDirectory = FileUtils
.getFirstDirectory(fileCanonicalPath);
final String simpleTypeName = StringUtils.replace(fileCanonicalPath,
typeDirectory + File.separator, "", 1).replace(".java", "");
final JavaPackage javaPackage = getTypeResolutionService()
.getPackage(fileCanonicalPath);
if (javaPackage == null) {
return null;
}
final JavaType javaType = new JavaType(
javaPackage.getFullyQualifiedPackageName() + "."
+ simpleTypeName);
final Pom module = getProjectOperations()
.getModuleForFileIdentifier(fileCanonicalPath);
Validate.notNull(module, "The module for the file '"
+ fileCanonicalPath + "' could not be located");
getTypeCache().cacheTypeAgainstModule(module, javaType);
String reducedPath = fileCanonicalPath.replace(
javaType.getRelativeFileName(), "");
reducedPath = StringUtils.stripEnd(reducedPath, File.separator);
for (final PhysicalPath physicalPath : module.getPhysicalPaths()) {
if (physicalPath.getLocationPath().startsWith(reducedPath)) {
final LogicalPath path = physicalPath.getLogicalPath();
physicalTypeIdentifier = MetadataIdentificationUtils.create(
PhysicalTypeIdentifier.class.getName(), path.getName()
+ "?" + javaType.getFullyQualifiedTypeName());
break;
}
}
getTypeCache().cacheFilePathAgainstTypeIdentifier(fileCanonicalPath,
physicalTypeIdentifier);
return physicalTypeIdentifier;
}