/** * Returns the package of the specified node. * @param node * @return the {@link JPackage} of a {@link JNode} or * <code>null</code> */ public JPackage getPackage(JNode node) { JCompilationUnit compilationUnit = getCompilationUnit(node); if (compilationUnit != null) { for (JNode child : compilationUnit.getChildren()) { if (child instanceof JPackage) { return (JPackage)child; } } } return null; }
public String getSourceCompilationUnitContents() { return sourceCompilationUnit.getContents(); }
/** * Fixes package contents to not include the header or the javadoc. * @param content * @return String * @see PackageDeclaration */ protected String fixPackageContent(String content) { String header = getFacadeHelper().getCompilationUnit(this).getHeader(); if (header != null && content.startsWith(header)) { content = content.substring(header.length()); } else { String javadoc = getFacadeHelper().toString(getASTNode().getJavadoc()); if (javadoc != null && content.startsWith(javadoc)) { content = content.substring(javadoc.length()); } } return content.trim(); } }
/** * Fixes package contents to not include the header or the javadoc. * @param content * @return String * @see PackageDeclaration */ protected String fixPackageContent(String content) { String header = getFacadeHelper().getCompilationUnit(this).getHeader(); if (header != null && content.startsWith(header)) { content = content.substring(header.length()); } else { String javadoc = getFacadeHelper().toString(getASTNode().getJavadoc()); if (javadoc != null && content.startsWith(javadoc)) { content = content.substring(javadoc.length()); } } return content.trim(); } }
/** * Returns the package of the specified node. * @param node * @return the {@link JPackage} of a {@link JNode} or * <code>null</code> */ public JPackage getPackage(JNode node) { JCompilationUnit compilationUnit = getCompilationUnit(node); if (compilationUnit != null) { for (JNode child : compilationUnit.getChildren()) { if (child instanceof JPackage) { return (JPackage)child; } } } return null; }
public String getSourceCompilationUnitContents() { return sourceCompilationUnit.getContents(); }
JCompilationUnit targetCompilationUnit = jMerger.getTargetCompilationUnit(); ImportManager importManager = getImportManager(); for (JNode node : targetCompilationUnit.getChildren())
result = targetCompilationUnit.getContents();
result = targetCompilationUnit.getContents();
String contents = compilationUnit.getContents(); int lastIndex = contents.length() - 1; int endIndex = contents.lastIndexOf("import");
String contents = compilationUnit.getContents(); int lastIndex = contents.length() - 1; int endIndex = contents.lastIndexOf("import");