Package com.github.javaparser.generator
Class Generator
java.lang.Object
com.github.javaparser.generator.Generator
- Direct Known Subclasses:
BndGenerator
,NodeGenerator
,TokenKindGenerator
,VisitorGenerator
A general pattern that the generators in this module will follow.
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected 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 <T extends Node & NodeWithAnnotations<?>>
voidannotateGenerated(T node)
protected void
annotateOverridden(MethodDeclaration method)
protected <T extends Node & NodeWithAnnotations<?>>
voidannotateSuppressWarnings(T node)
abstract void
generate()
protected void
removeMethodWithSameSignature(ClassOrInterfaceDeclaration containingClassOrInterface, CallableDeclaration<?> callable)
Removes all methods from containingClassOrInterface that have the same signature as callable.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.
-
Field Details
-
sourceRoot
-
-
Constructor Details
-
Generator
-
-
Method Details
-
generate
- Throws:
Exception
-
annotateGenerated
-
annotateSuppressWarnings
-
annotateOverridden
-
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. The method or constructor is annotated with the generator class. -
removeMethodWithSameSignature
protected void removeMethodWithSameSignature(ClassOrInterfaceDeclaration containingClassOrInterface, CallableDeclaration<?> callable)Removes all methods from containingClassOrInterface that have the same signature as callable. This is not used by any code, but it is useful when changing a generator and you need to get rid of a set of outdated methods.
-