I want use the Java Parser to add an inner class to an existing class.
I've tried
ClassOrInterfaceDeclaration classOrInterfaceType= cu.addClass("MyInnerClass", Modifier.PUBLIC,Modifier.STATIC);
but this adds a new class to the Java class i.e. not as an inner class.
Any help would be appreciated.
I want to insert a Builder into an existing class like
public class BuilderDemo {
public static class Builder{
}
}
I would like the node hierarchy look as follows:-
Any help would be appreciated.