static <N extends ResolvedReferenceTypeDeclaration> List<ResolvedConstructorDeclaration> getConstructors(NodeWithConstructors<?> wrappedNode, TypeSolver typeSolver, N container) { List<ResolvedConstructorDeclaration> declared = wrappedNode.getConstructors().stream() .map(c -> new JavaParserConstructorDeclaration<N>(container, c, typeSolver)) .collect(Collectors.toList()); if (declared.isEmpty()) { // If there are no constructors insert the default constructor return ImmutableList.of(new DefaultConstructorDeclaration<N>(container)); } else { return declared; } } }
@Override public List<ResolvedConstructorDeclaration> getConstructors() { List<ResolvedConstructorDeclaration> declared = new LinkedList<>(); for (BodyDeclaration<?> member : wrappedNode.getMembers()) { if (member instanceof com.github.javaparser.ast.body.ConstructorDeclaration) { com.github.javaparser.ast.body.ConstructorDeclaration constructorDeclaration = (com.github.javaparser.ast.body.ConstructorDeclaration) member; declared.add(new JavaParserConstructorDeclaration(this, constructorDeclaration, typeSolver)); } } if (declared.isEmpty()) { // If there are no constructors insert the default constructor return ImmutableList.of(new DefaultConstructorDeclaration(this)); } else { return declared; } }
@Override public List<ResolvedConstructorDeclaration> getConstructors() { List<ResolvedConstructorDeclaration> declared = new LinkedList<>(); for (BodyDeclaration<?> member : wrappedNode.getMembers()) { if (member instanceof com.github.javaparser.ast.body.ConstructorDeclaration) { com.github.javaparser.ast.body.ConstructorDeclaration constructorDeclaration = (com.github.javaparser.ast.body.ConstructorDeclaration) member; declared.add(new JavaParserConstructorDeclaration(this, constructorDeclaration, typeSolver)); } } if (declared.isEmpty()) { // If there are no constructors insert the default constructor return ImmutableList.of(new DefaultConstructorDeclaration(this)); } else { return declared; } }