当前位置: 首页>>代码示例>>Java>>正文


Java Pom.getPhysicalPaths方法代码示例

本文整理汇总了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;
}
 
开发者ID:gvSIGAssociation,项目名称:gvnix1,代码行数:22,代码来源:TypeLocationServiceImpl.java

示例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;
}
 
开发者ID:gvSIGAssociation,项目名称:gvnix1,代码行数:35,代码来源:MavenPathResolvingStrategy.java

示例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;
}
 
开发者ID:gvSIGAssociation,项目名称:gvnix1,代码行数:13,代码来源:MavenPathResolvingStrategy.java

示例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, '.');
}
 
开发者ID:gvSIGAssociation,项目名称:gvnix1,代码行数:39,代码来源:TypeLocationServiceImpl.java

示例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());
                }
            }
        }
    }
}
 
开发者ID:gvSIGAssociation,项目名称:gvnix1,代码行数:16,代码来源:TypeLocationServiceImpl.java

示例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;
}
 
开发者ID:gvSIGAssociation,项目名称:gvnix1,代码行数:12,代码来源:LogicalPathConverter.java

示例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;
}
 
开发者ID:gvSIGAssociation,项目名称:gvnix1,代码行数:47,代码来源:TypeLocationServiceImpl.java


注:本文中的org.springframework.roo.project.maven.Pom.getPhysicalPaths方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。