@Override public List<TypeDeclaration> getInnerTypes() { return compilationUnit.getTypes(); }
@Override public List<TypeDeclaration> getInnerTypes() { return compilationUnit.getTypes(); }
/** * Searches a compilation unit and locates the declaration with the given * type's simple name. * * @param compilationUnit to scan (required) * @param javaType the target to locate (required) * @return the located type declaration or null if it could not be found */ public static TypeDeclaration locateTypeDeclaration(final CompilationUnit compilationUnit, final JavaType javaType) { Validate.notNull(compilationUnit, "Compilation unit required"); Validate.notNull(javaType, "Java type to search for required"); if (compilationUnit.getTypes() == null) { return null; } for (final TypeDeclaration candidate : compilationUnit.getTypes()) { if (javaType.getSimpleTypeName().equals(candidate.getName())) { // We have the required type declaration return candidate; } } return null; }
boolean notFound; final List<TypeDeclaration> cidTypes = new ArrayList<TypeDeclaration>(cidCompilationUnit.getTypes()); for (final Iterator<TypeDeclaration> originalTypestIter = compilationUnit.getTypes().iterator(); originalTypestIter .hasNext();) { final TypeDeclaration originalType = originalTypestIter.next(); compilationUnit.getTypes().addAll(cidTypes);
fileIdentifier.substring(fileIdentifier.lastIndexOf(File.separator) + 1, fileIdentifier.lastIndexOf(".")); for (final TypeDeclaration typeDeclaration : compilationUnit.getTypes()) { if (typeName.equals(typeDeclaration.getName())) { return new JavaType(compilationUnit.getPackage().getName().getName() + "."
throw new IllegalStateException("Illegal state: JavaParser did not parse correctly", pe); final List<TypeDeclaration> types = ci.getTypes(); if (types == null || types.size() != 1) { throw new IllegalArgumentException("Field member invalid");
throw new IllegalStateException("Illegal state: JavaParser did not parse correctly", pe); final List<TypeDeclaration> types = ci.getTypes(); if (types == null || types.size() != 1) { throw new IllegalArgumentException("Method body invalid");
throw new IllegalStateException("Illegal state: JavaParser did not parse correctly", pe); final List<TypeDeclaration> types = ci.getTypes(); if (types == null || types.size() != 1) { throw new IllegalArgumentException("Method body invalid");
/** * Adds the given type declaration to the compilation unit. The list of * types will be initialized if it is <code>null</code>. * * @param cu * compilation unit * @param type * type declaration */ public static void addTypeDeclaration(CompilationUnit cu, TypeDeclaration type) { List<TypeDeclaration> types = cu.getTypes(); if (types == null) { types = new ArrayList<TypeDeclaration>(); cu.setTypes(types); } types.add(type); }
/** * Adds the given type declaration to the compilation unit. The list of * types will be initialized if it is <code>null</code>. * * @param cu * compilation unit * @param type * type declaration */ public static void addTypeDeclaration(CompilationUnit cu, TypeDeclaration type) { List<TypeDeclaration> types = cu.getTypes(); if (types == null) { types = new ArrayList<TypeDeclaration>(); cu.setTypes(types); } types.add(type); }
@Override public ClassOrInterfaceTypeDetails build() { Validate.notEmpty(compilationUnit.getTypes(), "No types in compilation unit, so unable to continue parsing");
public Boolean visit(CompilationUnit n1, Node arg) { CompilationUnit n2 = (CompilationUnit) arg; if (!nodeEquals(n1.getPackage(), n2.getPackage())) { return Boolean.FALSE; } if (!nodesEquals(n1.getImports(), n2.getImports())) { return Boolean.FALSE; } if (!nodesEquals(n1.getTypes(), n2.getTypes())) { return Boolean.FALSE; } return Boolean.TRUE; }
public Boolean visit(CompilationUnit n1, Node arg) { CompilationUnit n2 = (CompilationUnit) arg; if (!nodeEquals(n1.getPackage(), n2.getPackage())) { return Boolean.FALSE; } if (!nodesEquals(n1.getImports(), n2.getImports())) { return Boolean.FALSE; } if (!nodesEquals(n1.getTypes(), n2.getTypes())) { return Boolean.FALSE; } return Boolean.TRUE; }
public void visit(CompilationUnit n, A arg) { if (n.getPackage() != null) { n.getPackage().accept(this, arg); } if (n.getImports() != null) { for (ImportDeclaration i : n.getImports()) { i.accept(this, arg); } } if (n.getTypes() != null) { for (TypeDeclaration typeDeclaration : n.getTypes()) { typeDeclaration.accept(this, arg); } } }
public void visit(CompilationUnit n, Object arg) { if (n.getPackage() != null) { n.getPackage().accept(this, arg); } if (n.getImports() != null) { for (ImportDeclaration i : n.getImports()) { i.accept(this, arg); } printer.printLn(); } if (n.getTypes() != null) { for (Iterator<TypeDeclaration> i = n.getTypes().iterator(); i.hasNext();) { i.next().accept(this, arg); printer.printLn(); if (i.hasNext()) { printer.printLn(); } } } }
public void visit(CompilationUnit n, A arg) { if (n.getPackage() != null) { n.getPackage().accept(this, arg); } if (n.getImports() != null) { for (ImportDeclaration i : n.getImports()) { i.accept(this, arg); } } if (n.getTypes() != null) { for (TypeDeclaration typeDeclaration : n.getTypes()) { typeDeclaration.accept(this, arg); } } }
public R visit(CompilationUnit n, A arg) { if (n.getPackage() != null) { n.getPackage().accept(this, arg); } if (n.getImports() != null) { for (ImportDeclaration i : n.getImports()) { i.accept(this, arg); } } if (n.getTypes() != null) { for (TypeDeclaration typeDeclaration : n.getTypes()) { typeDeclaration.accept(this, arg); } } return null; }
public void visit(CompilationUnit n, Object arg) { if (n.getPackage() != null) { n.getPackage().accept(this, arg); } if (n.getImports() != null) { for (ImportDeclaration i : n.getImports()) { i.accept(this, arg); } printer.printLn(); } if (n.getTypes() != null) { for (Iterator<TypeDeclaration> i = n.getTypes().iterator(); i.hasNext();) { i.next().accept(this, arg); printer.printLn(); if (i.hasNext()) { printer.printLn(); } } } }
public R visit(CompilationUnit n, A arg) { if (n.getPackage() != null) { n.getPackage().accept(this, arg); } if (n.getImports() != null) { for (ImportDeclaration i : n.getImports()) { i.accept(this, arg); } } if (n.getTypes() != null) { for (TypeDeclaration typeDeclaration : n.getTypes()) { typeDeclaration.accept(this, arg); } } return null; }