final List<BodyDeclaration> bodyDeclarations = td.getMembers();
if (bodyDeclarations == null || bodyDeclarations.size() != 1) {
throw new IllegalStateException(
"Illegal state: JavaParser did not return body declarations correctly");
}
final BodyDeclaration bd = bodyDeclarations.get(0);
if (!(bd instanceof ConstructorDeclaration)) {
throw new IllegalStateException(
"Illegal state: JavaParser did not return a method declaration correctly");
}
final ConstructorDeclaration cd = (ConstructorDeclaration) bd;