Package com.github.javaparser.generator
Class NodeGenerator
- java.lang.Object
-
- com.github.javaparser.generator.Generator
-
- com.github.javaparser.generator.NodeGenerator
-
- Direct Known Subclasses:
CloneGenerator
,FinalGenerator
,GetMetaModelGenerator
,GetNodeListsGenerator
,MainConstructorGenerator
,PropertyGenerator
,RemoveMethodGenerator
,ReplaceMethodGenerator
public abstract class NodeGenerator extends Generator
Makes it easier to generate code in the core AST nodes. The generateNode method will get every node type passed to it, ready for modification.
-
-
Field Summary
-
Fields inherited from class com.github.javaparser.generator.Generator
sourceRoot
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
NodeGenerator(SourceRoot sourceRoot)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected void
addOrReplaceWhenSameSignature(ClassOrInterfaceDeclaration containingClassOrInterface, CallableDeclaration<?> callable)
Utility method that looks for a method or constructor with an identical signature as "callable" and replaces it with callable.protected void
after()
void
generate()
protected abstract void
generateNode(BaseNodeMetaModel nodeMetaModel, CompilationUnit nodeCu, ClassOrInterfaceDeclaration nodeCoid)
protected void
replaceWhenSameSignature(ClassOrInterfaceDeclaration containingClassOrInterface, CallableDeclaration<?> callable)
Utility method that looks for a method or constructor with an identical signature as "callable" and replaces it with callable.-
Methods inherited from class com.github.javaparser.generator.Generator
annotateGenerated, annotateOverridden, annotateSuppressWarnings
-
-
-
-
Constructor Detail
-
NodeGenerator
protected NodeGenerator(SourceRoot sourceRoot)
-
-
Method Detail
-
generate
public final void generate() throws Exception
-
generateNode
protected abstract void generateNode(BaseNodeMetaModel nodeMetaModel, CompilationUnit nodeCu, ClassOrInterfaceDeclaration nodeCoid)
-
addOrReplaceWhenSameSignature
protected void addOrReplaceWhenSameSignature(ClassOrInterfaceDeclaration containingClassOrInterface, CallableDeclaration<?> callable)
Utility method that looks for a method or constructor with an identical signature as "callable" and replaces it with callable. If not found, adds callable. When the new callable has no javadoc, any old javadoc will be kept.
-
replaceWhenSameSignature
protected void replaceWhenSameSignature(ClassOrInterfaceDeclaration containingClassOrInterface, CallableDeclaration<?> callable)
Utility method that looks for a method or constructor with an identical signature as "callable" and replaces it with callable. If not found, fails. When the new callable has no javadoc, any old javadoc will be kept.
-
-