org.kie.commons.java.nio.file.Path.startsWith()方法的使用及代码示例

x33g5p2x  于2022-01-26 转载在 其他  
字(5.2k)|赞(0)|评价(0)|浏览(175)

本文整理了Java中org.kie.commons.java.nio.file.Path.startsWith()方法的一些代码示例,展示了Path.startsWith()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Path.startsWith()方法的具体详情如下:
包路径:org.kie.commons.java.nio.file.Path
类名称:Path
方法名:startsWith

Path.startsWith介绍

暂无

代码示例

代码示例来源:origin: org.kie.workbench.services/kie-wb-common-project-backend

  1. @Override
  2. public boolean isKModule( final Path resource ) {
  3. //Null resource paths cannot resolve to a Project
  4. if ( resource == null ) {
  5. return false;
  6. }
  7. //Check if path equals kmodule.xml
  8. final Project project = resolveProject( resource );
  9. final org.kie.commons.java.nio.file.Path path = paths.convert( resource ).normalize();
  10. final org.kie.commons.java.nio.file.Path kmoduleFilePath = paths.convert( project.getKModuleXMLPath() );
  11. return path.startsWith( kmoduleFilePath );
  12. }

代码示例来源:origin: org.kie.workbench.services/kie-wb-common-project-backend

  1. @Override
  2. public boolean isPom( final Path resource ) {
  3. //Null resource paths cannot resolve to a Project
  4. if ( resource == null ) {
  5. return false;
  6. }
  7. //Check if path equals pom.xml
  8. final Project project = resolveProject( resource );
  9. final org.kie.commons.java.nio.file.Path path = paths.convert( resource ).normalize();
  10. final org.kie.commons.java.nio.file.Path pomFilePath = paths.convert( project.getPomXMLPath() );
  11. return path.startsWith( pomFilePath );
  12. }

代码示例来源:origin: org.kie.guvnor/guvnor-project-backend

  1. @Override
  2. public boolean isPom( final Path resource ) {
  3. //Null resource paths cannot resolve to a Project
  4. if ( resource == null ) {
  5. return false;
  6. }
  7. //Check if path equals pom.xml
  8. final Path projectRoot = resolveProject( resource );
  9. final org.kie.commons.java.nio.file.Path path = paths.convert( resource ).normalize();
  10. final org.kie.commons.java.nio.file.Path pomFilePath = paths.convert( projectRoot ).resolve( POM_PATH );
  11. return path.startsWith( pomFilePath );
  12. }

代码示例来源:origin: org.kie.guvnor/guvnor-project-backend

  1. @Override
  2. public boolean isKModule( final Path resource ) {
  3. //Null resource paths cannot resolve to a Project
  4. if ( resource == null ) {
  5. return false;
  6. }
  7. //Check if path equals kmodule.xml
  8. final Path projectRoot = resolveProject( resource );
  9. final org.kie.commons.java.nio.file.Path path = paths.convert( resource ).normalize();
  10. final org.kie.commons.java.nio.file.Path kmoduleFilePath = paths.convert( projectRoot ).resolve( KMODULE_PATH );
  11. return path.startsWith( kmoduleFilePath );
  12. }

代码示例来源:origin: org.kie.guvnor/guvnor-explorer-backend

  1. if ( pResource.startsWith( pSrcJavaResources ) ) {
  2. return makeProjectPackageList( resource,
  3. projectRootPath );
  4. if ( pResource.startsWith( pSrcResources ) ) {
  5. return makeProjectPackageList( resource,
  6. projectRootPath );
  7. if ( pResource.startsWith( pTestJavaResources ) ) {
  8. return makeProjectPackageList( resource,
  9. projectRootPath );
  10. if ( pResource.startsWith( pTestResources ) ) {
  11. return makeProjectPackageList( resource,
  12. projectRootPath );

代码示例来源:origin: org.kie.guvnor/guvnor-project-backend

  1. private Path doResolveSrcPackage( final Path resource,
  2. final Path projectRoot ) {
  3. //The pom.xml and kmodule.xml files are not within a package
  4. if ( isPom( resource ) || isKModule( resource ) ) {
  5. return null;
  6. }
  7. //The Path must be within a Project's src/main/java or src/main/resources path
  8. boolean resolved = false;
  9. org.kie.commons.java.nio.file.Path path = paths.convert( resource ).normalize();
  10. final org.kie.commons.java.nio.file.Path srcJavaPath = paths.convert( projectRoot ).resolve( SOURCE_JAVA_PATH );
  11. final org.kie.commons.java.nio.file.Path srcResourcesPath = paths.convert( projectRoot ).resolve( SOURCE_RESOURCES_PATH );
  12. //Check if path resides within a Java or Resources path
  13. if ( path.startsWith( srcJavaPath ) ) {
  14. resolved = true;
  15. } else if ( path.startsWith( srcResourcesPath ) ) {
  16. resolved = true;
  17. }
  18. if ( !resolved ) {
  19. return null;
  20. }
  21. //If the Path is already a folder simply return it
  22. if ( Files.isDirectory( path ) ) {
  23. return resource;
  24. }
  25. path = path.getParent();
  26. return paths.convert( path );
  27. }

代码示例来源:origin: org.kie.guvnor/guvnor-project-backend

  1. private Path doResolveTestPackage( final Path resource,
  2. final Path projectRoot ) {
  3. //The pom.xml and kmodule.xml files are not within a package
  4. if ( isPom( resource ) || isKModule( resource ) ) {
  5. return null;
  6. }
  7. //The Path must be within a Project's src/test/java or src/test/resources path
  8. boolean resolved = false;
  9. org.kie.commons.java.nio.file.Path path = paths.convert( resource ).normalize();
  10. final org.kie.commons.java.nio.file.Path testJavaPath = paths.convert( projectRoot ).resolve( TEST_JAVA_PATH );
  11. final org.kie.commons.java.nio.file.Path testResourcesPath = paths.convert( projectRoot ).resolve( TEST_RESOURCES_PATH );
  12. //Check if path resides within a Java or Resources path
  13. if ( path.startsWith( testJavaPath ) ) {
  14. resolved = true;
  15. } else if ( path.startsWith( testResourcesPath ) ) {
  16. resolved = true;
  17. }
  18. if ( !resolved ) {
  19. return null;
  20. }
  21. //If the Path is already a folder simply return it
  22. if ( Files.isDirectory( path ) ) {
  23. return resource;
  24. }
  25. path = path.getParent();
  26. return paths.convert( path );
  27. }

代码示例来源:origin: org.kie.workbench.services/kie-wb-common-project-backend

  1. if ( nioResource.startsWith( nioMainSrcPath ) ) {
  2. packagePath = nioMainSrcPath.relativize( nioResource );
  3. packageName = packagePath.toString().replaceAll( "/",
  4. "." );
  5. } else if ( nioResource.startsWith( nioTestSrcPath ) ) {
  6. packagePath = nioTestSrcPath.relativize( nioResource );
  7. packageName = packagePath.toString().replaceAll( "/",
  8. "." );
  9. } else if ( nioResource.startsWith( nioMainResourcesPath ) ) {
  10. packagePath = nioMainResourcesPath.relativize( nioResource );
  11. packageName = packagePath.toString().replaceAll( "/",
  12. "." );
  13. } else if ( nioResource.startsWith( nioTestResourcesPath ) ) {
  14. packagePath = nioTestResourcesPath.relativize( nioResource );
  15. packageName = packagePath.toString().replaceAll( "/",

相关文章