public class JDocComment extends JCommentPart implements IJGenerable, IJOwned
A javadoc comment consists of multiple parts. There's the main part (that
comes the first in in the comment section), then the parameter parts
(@param), the return part (@return), and the throws parts (@throws).
TODO: it would be nice if we have JComment class and we can derive this class
from there.
Modifier and Type | Field and Description |
---|---|
static String |
TAG_AUTHOR |
static String |
TAG_DEPRECATED |
static String |
TAG_SEE |
static String |
TAG_SINCE |
static String |
TAG_VERSION |
modCount
Modifier | Constructor and Description |
---|---|
protected |
JDocComment(JCodeModel owner) |
Modifier and Type | Method and Description |
---|---|
JCommentPart |
addAuthor()
Create an @author tag.
|
JCommentPart |
addDeprecated()
add a @deprecated tag to the javadoc, with the associated message.
|
JCommentPart |
addParam(JVar sParam)
Append a text to an @param tag.
|
JCommentPart |
addParam(String sParam)
Append a text to a @param tag to the javadoc
|
JCommentPart |
addReturn()
Appends a text to @return tag.
|
JCommentPart |
addTag(String sName) |
JCommentPart |
addThrows(AbstractJClass aException)
add a @throws tag to the javadoc
|
JCommentPart |
addThrows(Class<? extends Throwable> aException)
add a @throws tag to the javadoc
|
Map<String,String> |
addXdoclet(String sName)
add an xdoclet.
|
Map<String,String> |
addXdoclet(String sName,
Map<String,String> aAttributes)
add an xdoclet.
|
Map<String,String> |
addXdoclet(String sName,
String sAttribute,
String sValue)
add an xdoclet with
@name attribute = "value" . |
JDocComment |
append(Object o)
Appends a new value.
|
void |
generate(JFormatter f) |
JCommentPart |
getParam(JVar aParam) |
JCommentPart |
getParam(String sParam) |
JCommentPart |
getReturn() |
JCommentPart |
getTag(String sName) |
JCommentPart |
getThrows(AbstractJClass aException) |
JCommentPart |
getThrows(Class<? extends Throwable> aException) |
boolean |
isSingleLineMode() |
JCodeModel |
owner()
Gets the owner code model object.
|
void |
removeAllParams() |
void |
removeAllThrows() |
void |
removeAllXdoclets() |
void |
removeAuthor() |
void |
removeDeprecated() |
JCommentPart |
removeParam(JVar aParam) |
JCommentPart |
removeParam(String sParam) |
void |
removeReturn() |
JCommentPart |
removeTag(String sName) |
JCommentPart |
removeThrows(AbstractJClass aException) |
JCommentPart |
removeThrows(Class<? extends Throwable> aException) |
Map<String,String> |
removeXdoclet(String name) |
JDocComment |
setSingleLineMode(boolean bSingleLineMode)
Change whether multi line comments or single line comments should be
emitted.
|
add, format
add, addAll, addAll, clear, clone, contains, ensureCapacity, forEach, get, indexOf, isEmpty, iterator, lastIndexOf, listIterator, listIterator, remove, remove, removeAll, removeIf, removeRange, replaceAll, retainAll, set, size, sort, spliterator, subList, toArray, toArray, trimToSize
equals, hashCode
containsAll, toString
finalize, getClass, notify, notifyAll, wait, wait, wait
containsAll, equals, hashCode
parallelStream, stream
public static final String TAG_AUTHOR
public static final String TAG_DEPRECATED
public static final String TAG_SEE
public static final String TAG_SINCE
public static final String TAG_VERSION
protected JDocComment(@Nonnull JCodeModel owner)
@Nonnull public JCodeModel owner()
IJOwned
@Nonnull public JDocComment setSingleLineMode(boolean bSingleLineMode)
bSingleLineMode
- true
to enable single line mode, false
for
multi line mode (which is the default).public boolean isSingleLineMode()
true
if single line mode is enabled,
false
if multi line mode is enabled. Multi line mode
is the default.public JDocComment append(@Nullable Object o)
JCommentPart
append
in class JCommentPart
o
- If the value is AbstractJType
it will be printed as a @link
tag. Otherwise it will be converted to String via
Object.toString()
.@Nonnull public JCommentPart addParam(@Nonnull String sParam)
sParam
- Parameter to be addedJCommentPart
public JCommentPart addParam(@Nonnull JVar sParam)
sParam
- Parameter to be addedJCommentPart
@Nullable public JCommentPart removeParam(@Nullable String sParam)
@Nullable public JCommentPart removeParam(@Nonnull JVar aParam)
public void removeAllParams()
@Nullable public JCommentPart getParam(@Nullable String sParam)
@Nullable public JCommentPart getParam(@Nonnull JVar aParam)
@Nonnull public JCommentPart addReturn()
JCommentPart
@Nullable public JCommentPart getReturn()
public void removeReturn()
public JCommentPart addThrows(@Nonnull Class<? extends Throwable> aException)
aException
- Exception to be added. May not be null
.JCommentPart
@Nonnull public JCommentPart addThrows(@Nonnull AbstractJClass aException)
aException
- Exception to be added. May not be null
.JCommentPart
@Nullable public JCommentPart removeThrows(@Nonnull Class<? extends Throwable> aException)
@Nullable public JCommentPart removeThrows(@Nullable AbstractJClass aException)
public void removeAllThrows()
@Nullable public JCommentPart getThrows(@Nonnull Class<? extends Throwable> aException)
@Nullable public JCommentPart getThrows(@Nullable AbstractJClass aException)
@Nonnull public JCommentPart addTag(@Nonnull String sName)
@Nullable public JCommentPart removeTag(@Nullable String sName)
@Nullable public JCommentPart getTag(@Nullable String sName)
@Nonnull public JCommentPart addAuthor()
JCommentPart
addTag(String)
public void removeAuthor()
@Nonnull public JCommentPart addDeprecated()
JCommentPart
addTag(String)
public void removeDeprecated()
@Nonnull public Map<String,String> addXdoclet(@Nonnull String sName)
sName
- xdoclet name@Nonnull public Map<String,String> addXdoclet(@Nonnull String sName, @Nonnull Map<String,String> aAttributes)
sName
- xdoclet nameaAttributes
- Attributes to be added@Nonnull public Map<String,String> addXdoclet(@Nonnull String sName, @Nonnull String sAttribute, @Nullable String sValue)
@name attribute = "value"
. If value is
null
than it will be @name attribute
.sName
- xdoclet namesAttribute
- Attribute name to be addedsValue
- Attribute value to be addedpublic void removeAllXdoclets()
public void generate(@Nonnull JFormatter f)
generate
in interface IJGenerable
Copyright © 2013–2017 Philip Helger. All rights reserved.