Class MethodWriter

java.lang.Object
de.hybris.bootstrap.codegenerator.AbstractImportProvider
de.hybris.bootstrap.codegenerator.MethodWriter
All Implemented Interfaces:
CodeWriter
Direct Known Subclasses:
AbstractAttributeMethodWriter, AlternativeModelGetterWriter, AlternativeModelSetterWriter, AttributeMethodDelegate, ModelConstructorWriter, ModelGetterWriter, ModelSetterWriter

public class MethodWriter extends AbstractImportProvider
  • Field Details

  • Constructor Details

    • MethodWriter

      public MethodWriter(String name)
    • MethodWriter

      public MethodWriter(String returnType, String name)
    • MethodWriter

      public MethodWriter(Visibility visibility, String returnType, String name)
  • Method Details

    • write

      public void write(JavaFile file)
    • modifiersToString

      public static String modifiersToString(int modifiers)
    • writeContent

      protected void writeContent(JavaFile file)
    • addParameter

      public void addParameter(String type, String name)
    • getSignature

      public Map<String,String> getSignature()
    • getParameterType

      public String getParameterType(String name)
    • assembleSignature

      protected String assembleSignature()
    • assembleThrowsClause

      protected String assembleThrowsClause()
    • getVisibility

      public Visibility getVisibility()
      Returns:
      the visibility
    • setVisibility

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

      public 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(String plainText)
    • writeTextToFile

      public static void writeTextToFile(JavaFile file, String plainText)
    • analyzeAndStripReturnType

      protected String analyzeAndStripReturnType(String original)
    • extractClassNames

      public static Set<String> extractClassNames(String expression)
    • stripPackageName

      public static String stripPackageName(String className)
    • getReturnType

      public String getReturnType()
      Returns:
      the returnType
    • getRequiredImports

      public Set<String> getRequiredImports()
      Overrides:
      getRequiredImports in class AbstractImportProvider
    • setReturnType

      public void setReturnType(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(String deprecatedSince)
    • addAnnotation

      public void addAnnotation(String anno)
    • getAnnotations

      public Set<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(String exceptionType)
    • getThrownExceptions

      public Set<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 String getJavadoc()
      Gets the javadoc for the method.
      Returns:
      javadoc as normal string without the comment characters
    • setJavadoc

      public void setJavadoc(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(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