Class JavaSourceWriterBuilder


  • public class JavaSourceWriterBuilder
    extends java.lang.Object
    A builder for JavaSourceWriter instances.

    Experimental API - subject to change.

    • Constructor Detail

      • JavaSourceWriterBuilder

        public JavaSourceWriterBuilder​(AbortablePrintWriter printWriter,
                                       java.lang.String packageName,
                                       java.lang.String className)
        Parameters:
        printWriter -
        packageName -
        className -
    • Method Detail

      • addAnnotationDeclaration

        public void addAnnotationDeclaration​(java.lang.String declaration)
        Add an class/interface annotation.
        Parameters:
        declaration -
      • addImplementedInterface

        public void addImplementedInterface​(java.lang.String intfName)
        Add an implemented/extended interface.
        Parameters:
        intfName -
      • addImport

        public void addImport​(java.lang.String typeName)
        Add an import entry.
        Parameters:
        typeName - fully-qualified source name
      • createSourceWriter

        public SourceWriter createSourceWriter()
        Creates an implementation of JavaSourceWriter that can be used to write the innards of a class. Note that the subsequent changes to this factory do not affect the returned instance.
        Returns:
        a JavaSourceWriter instance
        Throws:
        java.lang.RuntimeException - If the settings on this factory are inconsistent or invalid
      • getAnnotationDeclarations

        public java.lang.Iterable<java.lang.String> getAnnotationDeclarations()
        Get the annotations.
        Returns:
        list of annotations
      • getClassName

        public java.lang.String getClassName()
        Get the simple name of the class being created.
        Returns:
        class name
      • getFullyQualifiedClassName

        public java.lang.String getFullyQualifiedClassName()
        Get the fully-qualified source name of the class being created.
        Returns:
        fqcn
      • getInterfaceNames

        public java.lang.Iterable<java.lang.String> getInterfaceNames()
        Get the implemented/extended interfaces for the class being created.
        Returns:
        list of interface names
      • getPackageName

        public java.lang.String getPackageName()
        Get the package of the class being created.
        Returns:
        package name
      • getSuperclassName

        public java.lang.String getSuperclassName()
        Get the superclass for the class being created.
        Returns:
        superclass name
      • makeInterface

        public void makeInterface()
        We are creating an interface instead of a class.
      • setJavaDocCommentForClass

        public void setJavaDocCommentForClass​(java.lang.String comment)
        Sets the java doc comment for this.
        Parameters:
        comment - java doc comment.
      • setSuperclass

        public void setSuperclass​(java.lang.String superclassName)
        Set the superclass of the class being created.
        Parameters:
        superclassName -