Class Generator

    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected com.github.javaparser.utils.SourceRoot sourceRoot  
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      protected Generator​(com.github.javaparser.utils.SourceRoot sourceRoot)  
    • Method Summary

      All Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      protected void addOrReplaceWhenSameSignature​(com.github.javaparser.ast.body.ClassOrInterfaceDeclaration containingClassOrInterface, com.github.javaparser.ast.body.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 com.github.javaparser.ast.Node & com.github.javaparser.ast.nodeTypes.NodeWithAnnotations<?>>
      void
      annotateGenerated​(T node)  
      protected void annotateOverridden​(com.github.javaparser.ast.body.MethodDeclaration method)  
      protected <T extends com.github.javaparser.ast.Node & com.github.javaparser.ast.nodeTypes.NodeWithAnnotations<?>>
      void
      annotateSuppressWarnings​(T node)  
      abstract void generate()  
      protected void removeMethodWithSameSignature​(com.github.javaparser.ast.body.ClassOrInterfaceDeclaration containingClassOrInterface, com.github.javaparser.ast.body.CallableDeclaration<?> callable)
      Removes all methods from containingClassOrInterface that have the same signature as callable.
      protected void replaceWhenSameSignature​(com.github.javaparser.ast.body.ClassOrInterfaceDeclaration containingClassOrInterface, com.github.javaparser.ast.body.CallableDeclaration<?> callable)
      Utility method that looks for a method or constructor with an identical signature as "callable" and replaces it with callable.
    • Field Detail

      • sourceRoot

        protected final com.github.javaparser.utils.SourceRoot sourceRoot
    • Constructor Detail

      • Generator

        protected Generator​(com.github.javaparser.utils.SourceRoot sourceRoot)
    • Method Detail

      • annotateGenerated

        protected <T extends com.github.javaparser.ast.Node & com.github.javaparser.ast.nodeTypes.NodeWithAnnotations<?>> void annotateGenerated​(T node)
      • annotateSuppressWarnings

        protected <T extends com.github.javaparser.ast.Node & com.github.javaparser.ast.nodeTypes.NodeWithAnnotations<?>> void annotateSuppressWarnings​(T node)
      • annotateOverridden

        protected void annotateOverridden​(com.github.javaparser.ast.body.MethodDeclaration method)
      • addOrReplaceWhenSameSignature

        protected void addOrReplaceWhenSameSignature​(com.github.javaparser.ast.body.ClassOrInterfaceDeclaration containingClassOrInterface,
                                                     com.github.javaparser.ast.body.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​(com.github.javaparser.ast.body.ClassOrInterfaceDeclaration containingClassOrInterface,
                                                com.github.javaparser.ast.body.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​(com.github.javaparser.ast.body.ClassOrInterfaceDeclaration containingClassOrInterface,
                                                     com.github.javaparser.ast.body.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.