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 CommentTextContentCLOSE_PAREN_CONTENT(package private) static CommentTextContentCOMMA_CONTENTprivate java.util.List<Writable>content(package private) static InlineDocTagCommentContentDOC_ROOT_CONTENT(package private) static CommentTextContentHASH_CONTENT(package private) static CommentContentNL_CONTENT(package private) static CommentTextContentOPEN_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) voidaddItemDirectly(Writable item)JCommentblock()Add a comment sub-block at this location.JCommentcode()Add an inline code tag.JCommentdocRoot()Add the{@docRoot}tag at this position.(package private) java.util.List<Writable>getContent()JCommentinlineDocTag(java.lang.String tag)Add an inline doc tag.JCommentinlineDocTag(java.lang.String tag, java.lang.String body)Add an inline doc tag with simple content.JCommentlinkConstructor(boolean plain, JType targetType, JType... params)Add an inline@linkto a constructor.JCommentlinkField(boolean plain, JType targetType, java.lang.String targetField)Add an inline@linkto a field of a type.JCommentlinkMethod(boolean plain, JMethodDef methodDef)Add an inline@linkto a method.JCommentlinkMethod(boolean plain, JType targetType, java.lang.String targetMethod, JType... params)Add an inline@linkto a method.JCommentlinkType(boolean plain, JType targetType)Add an inline@linkto a type.JCommentnl()Add a newline.JCommentsp()Add a non-trailing space.JCommenttext(java.lang.String text)Add some text to the end of this comment.JCommenttypeName(JType type)Add a type name to the end of this comment.voidwrite(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:JCommentAdd some text to the end of this comment. No formatting or line breaks are inserted.
-
sp
public JComment sp()
Description copied from interface:JCommentAdd a non-trailing space. If no content follows, the space will be omitted.
-
typeName
public JComment typeName(JType type)
Description copied from interface:JCommentAdd 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:JCommentAdd 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:JCommentAdd an inline doc tag with simple content.- Specified by:
inlineDocTagin 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:JCommentAdd an inline doc tag.- Specified by:
inlineDocTagin 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:JCommentAdd an inline@linkto a type.
-
linkField
public JComment linkField(boolean plain, JType targetType, java.lang.String targetField)
Description copied from interface:JCommentAdd an inline@linkto a field of a type.
-
linkConstructor
public JComment linkConstructor(boolean plain, JType targetType, JType... params)
Description copied from interface:JCommentAdd an inline@linkto a constructor.- Specified by:
linkConstructorin interfaceJComment- Parameters:
plain-trueto render in plain font,falseto render inmonospacefonttargetType- 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:JCommentAdd an inline@linkto a method.- Specified by:
linkMethodin interfaceJComment- Parameters:
plain-trueto render in plain font,falseto render inmonospacefonttargetType- 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:JCommentAdd an inline@linkto a method.- Specified by:
linkMethodin interfaceJComment- Parameters:
plain-trueto render in plain font,falseto render inmonospacefontmethodDef- the method to link to- Returns:
- the body of the link tag
-
docRoot
public JComment docRoot()
Description copied from interface:JCommentAdd the{@docRoot}tag at this position.
-
write
public void write(SourceFileWriter writer) throws java.io.IOException
-
getContent
java.util.List<Writable> getContent()
-
-