Class CommentTemplate
java.lang.Object
de.japkit.test.members.common.comment.CommentTemplate
@Clazz(commentExpr="The generated class for the example.")
@RuntimeMetadata
public class CommentTemplate
extends java.lang.Object
Comments for members can be set by evaluating the commentExpr annotation
value or by evaluating the comment of the template.
The examples here are for fields but apply to methods and inner classes as well.
-
Field Summary
Fields Modifier and Type Field Description (package private) de.japkit.functions.SrcType
$name$Copy
The comment can also be copied from the source element.(package private) java.lang.String
someString1
This comment is just copied as it is.(package private) java.lang.String
someString2
Since the comment is not just copied, but evaluated as a Java EL expression, it is for example possible to use the name of the generated class: #{src.simpleName}.(package private) java.lang.String
someString3
When the template's comment shall not be used for generating the comment, the annotation value commentExpr can be used instead. -
Constructor Summary
Constructors Constructor Description CommentTemplate()
-
Method Summary
-
Field Details
-
someString1
java.lang.String someString1This comment is just copied as it is. -
someString2
java.lang.String someString2Since the comment is not just copied, but evaluated as a Java EL expression, it is for example possible to use the name of the generated class: #{src.simpleName}.This is also a nice debugging tool for showing the result expressions: #{src.enclosedElements.stream().filter(e -> e.kind == 'FIELD').toList()}
-
someString3
@Field(commentExpr="The real comment.") java.lang.String someString3When the template's comment shall not be used for generating the comment, the annotation value commentExpr can be used instead. -
$name$Copy
@Field(src="#{src.enclosedElements.stream().filter(e -> e.kind == \'FIELD\').toList()}", commentFromSrc=true) de.japkit.functions.SrcType $name$CopyThe comment can also be copied from the source element. The src variable must be anElement
for this. SeeSourceTemplate
for more details.Comments from source elements are usually not available during incremental build.
-
-
Constructor Details
-
CommentTemplate
public CommentTemplate()
-