Package org.jboss.jdeparser
Class AbstractJComment
- java.lang.Object
-
- org.jboss.jdeparser.AbstractJComment
-
- Direct Known Subclasses:
AbstractJHtmlComment
,BlockJComment
,InlineDocTagCommentContent
,LineJComment
,NestedCommentContent
abstract class AbstractJComment extends java.lang.Object implements JComment, Writable
-
-
Field Summary
Fields Modifier and Type Field Description (package private) static CommentTextContent
CLOSE_PAREN_CONTENT
(package private) static CommentTextContent
COMMA_CONTENT
private java.util.List<Writable>
content
(package private) static InlineDocTagCommentContent
DOC_ROOT_CONTENT
(package private) static CommentTextContent
HASH_CONTENT
(package private) static CommentContent
NL_CONTENT
(package private) static CommentTextContent
OPEN_PAREN_CONTENT
-
Constructor Summary
Constructors Constructor Description AbstractJComment()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected <T extends CommentContent>
Tadd(T item)
(package private) void
addItemDirectly(Writable item)
JComment
block()
Add a comment sub-block at this location.JComment
code()
Add an inline code tag.JComment
docRoot()
Add the{@docRoot}
tag at this position.(package private) java.util.List<Writable>
getContent()
JComment
inlineDocTag(java.lang.String tag)
Add an inline doc tag.JComment
inlineDocTag(java.lang.String tag, java.lang.String body)
Add an inline doc tag with simple content.JComment
linkConstructor(boolean plain, JType targetType, JType... params)
Add an inline@link
to a constructor.JComment
linkField(boolean plain, JType targetType, java.lang.String targetField)
Add an inline@link
to a field of a type.JComment
linkMethod(boolean plain, JMethodDef methodDef)
Add an inline@link
to a method.JComment
linkMethod(boolean plain, JType targetType, java.lang.String targetMethod, JType... params)
Add an inline@link
to a method.JComment
linkType(boolean plain, JType targetType)
Add an inline@link
to a type.JComment
nl()
Add a newline.JComment
sp()
Add a non-trailing space.JComment
text(java.lang.String text)
Add some text to the end of this comment.JComment
typeName(JType type)
Add a type name to the end of this comment.void
write(SourceFileWriter writer)
-
-
-
Field Detail
-
NL_CONTENT
static final CommentContent NL_CONTENT
-
HASH_CONTENT
static final CommentTextContent HASH_CONTENT
-
OPEN_PAREN_CONTENT
static final CommentTextContent OPEN_PAREN_CONTENT
-
COMMA_CONTENT
static final CommentTextContent COMMA_CONTENT
-
CLOSE_PAREN_CONTENT
static final CommentTextContent CLOSE_PAREN_CONTENT
-
DOC_ROOT_CONTENT
static final InlineDocTagCommentContent DOC_ROOT_CONTENT
-
content
private java.util.List<Writable> content
-
-
Method Detail
-
addItemDirectly
void addItemDirectly(Writable item)
-
add
protected <T extends CommentContent> T add(T item)
-
text
public JComment text(java.lang.String text)
Description copied from interface:JComment
Add some text to the end of this comment. No formatting or line breaks are inserted.
-
sp
public JComment sp()
Description copied from interface:JComment
Add a non-trailing space. If no content follows, the space will be omitted.
-
typeName
public JComment typeName(JType type)
Description copied from interface:JComment
Add a type name to the end of this comment. If the type is imported, it will emit as a simple name, otherwise it will emit as a qualified name.
-
block
public JComment block()
Description copied from interface:JComment
Add a comment sub-block at this location. The block has no visual representation but allows text to be inserted at the point of the block even after more content was appended after it.
-
inlineDocTag
public JComment inlineDocTag(java.lang.String tag, java.lang.String body)
Description copied from interface:JComment
Add an inline doc tag with simple content.- Specified by:
inlineDocTag
in interfaceJComment
- Parameters:
tag
- the tag name (without the leading@
sign)body
- the complete tag body- Returns:
- this comment
-
inlineDocTag
public JComment inlineDocTag(java.lang.String tag)
Description copied from interface:JComment
Add an inline doc tag.- Specified by:
inlineDocTag
in interfaceJComment
- Parameters:
tag
- the tag name (without the leading@
sign)- Returns:
- the body of the doc tag
-
linkType
public JComment linkType(boolean plain, JType targetType)
Description copied from interface:JComment
Add an inline@link
to a type.
-
linkField
public JComment linkField(boolean plain, JType targetType, java.lang.String targetField)
Description copied from interface:JComment
Add an inline@link
to a field of a type.
-
linkConstructor
public JComment linkConstructor(boolean plain, JType targetType, JType... params)
Description copied from interface:JComment
Add an inline@link
to a constructor.- Specified by:
linkConstructor
in interfaceJComment
- Parameters:
plain
-true
to render in plain font,false
to render inmonospace
fonttargetType
- the target type to link toparams
- the argument types of the constructor to link to- Returns:
- the body of the link tag
-
linkMethod
public JComment linkMethod(boolean plain, JType targetType, java.lang.String targetMethod, JType... params)
Description copied from interface:JComment
Add an inline@link
to a method.- Specified by:
linkMethod
in interfaceJComment
- Parameters:
plain
-true
to render in plain font,false
to render inmonospace
fonttargetType
- the target type to link totargetMethod
- the name of the method to link toparams
- the argument types of the method to link to- Returns:
- the body of the link tag
-
linkMethod
public JComment linkMethod(boolean plain, JMethodDef methodDef)
Description copied from interface:JComment
Add an inline@link
to a method.- Specified by:
linkMethod
in interfaceJComment
- Parameters:
plain
-true
to render in plain font,false
to render inmonospace
fontmethodDef
- the method to link to- Returns:
- the body of the link tag
-
docRoot
public JComment docRoot()
Description copied from interface:JComment
Add the{@docRoot}
tag at this position.
-
write
public void write(SourceFileWriter writer) throws java.io.IOException
-
getContent
java.util.List<Writable> getContent()
-
-