Beispiel #1
0
  private JavaResource getJavaResource(final DirectoryResource sourceDir, final String relativePath)
      throws FileNotFoundException {
    if (Strings.isNullOrEmpty(relativePath)) {
      throw new FileNotFoundException("Empty relative path");
    }
    String path =
        relativePath.trim().endsWith(".java")
            ? relativePath.substring(0, relativePath.lastIndexOf(".java"))
            : relativePath;

    path = Packages.toFileSyntax(path) + ".java";
    JavaResource target = sourceDir.getChildOfType(JavaResource.class, path);
    return target;
  }