Class MethodWriter

    • Constructor Detail

      • MethodWriter

        public MethodWriter​(java.lang.String name)
      • MethodWriter

        public MethodWriter​(java.lang.String returnType,
                            java.lang.String name)
      • MethodWriter

        public MethodWriter​(Visibility visibility,
                            java.lang.String returnType,
                            java.lang.String name)
    • Method Detail

      • write

        public void write​(JavaFile file)
      • modifiersToString

        public static java.lang.String modifiersToString​(int modifiers)
      • writeContent

        protected void writeContent​(JavaFile file)
      • addParameter

        public void addParameter​(java.lang.String type,
                                 java.lang.String name)
      • getSignature

        public java.util.Map<java.lang.String,​java.lang.String> getSignature()
      • getParameterType

        public java.lang.String getParameterType​(java.lang.String name)
      • assembleSignature

        protected java.lang.String assembleSignature()
      • assembleThrowsClause

        protected java.lang.String assembleThrowsClause()
      • getVisibility

        public Visibility getVisibility()
        Returns:
        the visibility
      • setVisibility

        public void setVisibility​(Visibility visibility)
        Parameters:
        visibility - the visibility to set
      • getName

        public java.lang.String getName()
        Returns:
        the name
      • getContent

        public CodeWriter getContent()
        Returns:
        the content
      • setContent

        public void setContent​(CodeWriter content)
        Parameters:
        content - the content to set
      • setContentPlain

        public void setContentPlain​(java.lang.String plainText)
      • writeTextToFile

        public static void writeTextToFile​(JavaFile file,
                                           java.lang.String plainText)
      • analyzeAndStripReturnType

        protected java.lang.String analyzeAndStripReturnType​(java.lang.String original)
      • extractClassNames

        public static java.util.Set<java.lang.String> extractClassNames​(java.lang.String expression)
      • stripPackageName

        public static java.lang.String stripPackageName​(java.lang.String className)
      • getReturnType

        public java.lang.String getReturnType()
        Returns:
        the returnType
      • setReturnType

        public void setReturnType​(java.lang.String returnType)
        Parameters:
        returnType - the returnType to set
      • isAbstract

        public boolean isAbstract()
        Returns:
        the isAbstract
      • setAbstract

        public void setAbstract​(boolean isAbstract)
        Parameters:
        isAbstract - the isAbstract to set
      • addDeprecatedAnnotation

        public void addDeprecatedAnnotation​(java.lang.String deprecatedSince)
      • addAnnotation

        public void addAnnotation​(java.lang.String anno)
      • getAnnotations

        public java.util.Set<java.lang.String> getAnnotations()
        Returns:
        the annotations
      • getModifiers

        public int getModifiers()
        Returns:
        the modifiers
      • setModifiers

        public void setModifiers​(int modifiers)
        Parameters:
        modifiers - the modifiers to set
      • addThrownException

        public void addThrownException​(java.lang.String exceptionType)
      • getThrownExceptions

        public java.util.Set<java.lang.String> getThrownExceptions()
        Returns:
        the thrownExceptions
      • isConstructor

        public boolean isConstructor()
        Returns:
        the isConstructor
      • setConstructor

        public void setConstructor​(boolean isConstructor)
        Parameters:
        isConstructor - the isConstructor to set
      • getJavadoc

        public java.lang.String getJavadoc()
        Gets the javadoc for the method.
        Returns:
        javadoc as normal string without the comment characters
      • setJavadoc

        public void setJavadoc​(java.lang.String javadoc)
        Sets the javadoc for the method.
        Parameters:
        javadoc - the new javadoc string for the method. Note: Comment characters should be left out.
      • addComment

        public void addComment​(java.lang.String comment)
        Adds to the method a single comment line above the java doc for additional comments for the developer. Please: Do not use \n or \r. Currently used for model constructors to show where the constructor was defined
        Parameters:
        comment - the comment