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
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intstatic final intstatic final intstatic final int -
Constructor Summary
ConstructorsConstructorDescriptionMethodWriter(Visibility visibility, String returnType, String name) MethodWriter(String name) MethodWriter(String returnType, String name) -
Method Summary
Modifier and TypeMethodDescriptionvoidaddAnnotation(String anno) voidaddComment(String comment) Adds to the method a single comment line above the java doc for additional comments for the developer.voidaddDeprecatedAnnotation(String deprecatedSince) voidaddParameter(String type, String name) voidaddThrownException(String exceptionType) protected StringanalyzeAndStripReturnType(String original) protected Stringprotected StringextractClassNames(String expression) Gets the javadoc for the method.intgetName()getParameterType(String name) booleanbooleanstatic StringmodifiersToString(int modifiers) voidsetAbstract(boolean isAbstract) voidsetConstructor(boolean isConstructor) voidsetContent(CodeWriter content) voidsetContentPlain(String plainText) voidsetJavadoc(String javadoc) Sets the javadoc for the method.voidsetModifiers(int modifiers) voidsetReturnType(String returnType) voidsetVisibility(Visibility visibility) static StringstripPackageName(String className) voidprotected voidwriteContent(JavaFile file) static voidwriteTextToFile(JavaFile file, String plainText) Methods inherited from class de.hybris.bootstrap.codegenerator.AbstractImportProvider
addRequiredImport
-
Field Details
-
FINAL
public static final int FINAL- See Also:
-
STATIC
public static final int STATIC- See Also:
-
SYNCHRONIZED
public static final int SYNCHRONIZED- See Also:
-
ABSTRACT
public static final int ABSTRACT- See Also:
-
-
Constructor Details
-
MethodWriter
-
MethodWriter
-
MethodWriter
-
-
Method Details
-
write
-
modifiersToString
-
writeContent
-
addParameter
-
getSignature
-
getParameterType
-
assembleSignature
-
assembleThrowsClause
-
getVisibility
- Returns:
- the visibility
-
setVisibility
- Parameters:
visibility- the visibility to set
-
getName
- Returns:
- the name
-
getContent
- Returns:
- the content
-
setContent
- Parameters:
content- the content to set
-
setContentPlain
-
writeTextToFile
-
analyzeAndStripReturnType
-
extractClassNames
-
stripPackageName
-
getReturnType
- Returns:
- the returnType
-
getRequiredImports
- Overrides:
getRequiredImportsin classAbstractImportProvider
-
setReturnType
- 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
-
addAnnotation
-
getAnnotations
- Returns:
- the annotations
-
getModifiers
public int getModifiers()- Returns:
- the modifiers
-
setModifiers
public void setModifiers(int modifiers) - Parameters:
modifiers- the modifiers to set
-
addThrownException
-
getThrownExceptions
- Returns:
- the thrownExceptions
-
isConstructor
public boolean isConstructor()- Returns:
- the isConstructor
-
setConstructor
public void setConstructor(boolean isConstructor) - Parameters:
isConstructor- the isConstructor to set
-
getJavadoc
Gets the javadoc for the method.- Returns:
- javadoc as normal string without the comment characters
-
setJavadoc
Sets the javadoc for the method.- Parameters:
javadoc- the new javadoc string for the method. Note: Comment characters should be left out.
-
addComment
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
-