public enum JavadocTagInfo extends java.lang.Enum<JavadocTagInfo>
This class was modeled after documentation located at javadoc and how to write.
Some of this documentation was a little incomplete (ex: valid placement of code, value, and literal tags).
Whenever an inconsistency was found the author's judgment was used.
For now, the number of required/optional tag arguments are not included
because some Javadoc tags have very complex rules for determining this
(ex: {@value}
tag).
Also, the isValidOn
method does not consider
classes defined in a local code block (method, init block, etc.).
Modifier and Type | Class and Description |
---|---|
static class |
JavadocTagInfo.Type
The Javadoc Type.
|
Enum Constant and Description |
---|
AUTHOR
@author . |
CODE
{@code} . |
DEPRECATED
@deprecated . |
DOC_ROOT
{@docRoot} . |
EXCEPTION
@exception . |
INHERIT_DOC
{@inheritDoc} . |
LINK
{@link} . |
LINKPLAIN
{@linkplain} . |
LITERAL
{@literal} . |
PARAM
@param . |
RETURN
@return . |
SEE
@see . |
SERIAL
@serial . |
SERIAL_DATA
@serialData . |
SERIAL_FIELD
@serialField . |
SINCE
@since . |
THROWS
@throws . |
VALUE
{@value} . |
VERSION
@version . |
Modifier and Type | Field and Description |
---|---|
private static int[] |
DEF_TOKEN_TYPES
Default token types.
|
private static int[] |
DEF_TOKEN_TYPES_DEPRECATED
Default token types for DEPRECATED Javadoc tag.
|
private java.lang.String |
name
The tag name.
|
private static java.util.Map<java.lang.String,JavadocTagInfo> |
NAME_TO_TAG
Holds tag name to tag enum mappings.
|
private java.lang.String |
text
The tag text.
|
private static java.util.Map<java.lang.String,JavadocTagInfo> |
TEXT_TO_TAG
Holds tag text to tag enum mappings.
|
private JavadocTagInfo.Type |
type
The tag type.
|
Modifier and Type | Method and Description |
---|---|
static JavadocTagInfo |
fromName(java.lang.String name)
Returns a JavadocTag from the tag name.
|
static JavadocTagInfo |
fromText(java.lang.String text)
Returns a JavadocTag from the tag text.
|
java.lang.String |
getName()
Gets the tag name.
|
java.lang.String |
getText()
Gets the tag text.
|
JavadocTagInfo.Type |
getType()
Gets the Tag type defined by
Type . |
static boolean |
isValidName(java.lang.String name)
Returns whether the provided name is for a valid tag.
|
abstract boolean |
isValidOn(DetailAST ast)
Checks if a particular Javadoc tag is valid within a Javadoc block of a
given AST.
|
java.lang.String |
toString() |
static JavadocTagInfo |
valueOf(java.lang.String name)
Returns the enum constant of this type with the specified name.
|
static JavadocTagInfo[] |
values()
Returns an array containing the constants of this enum type, in
the order they are declared.
|
public static final JavadocTagInfo AUTHOR
@author
.public static final JavadocTagInfo CODE
{@code}
.public static final JavadocTagInfo DOC_ROOT
{@docRoot}
.public static final JavadocTagInfo DEPRECATED
@deprecated
.public static final JavadocTagInfo EXCEPTION
@exception
.public static final JavadocTagInfo INHERIT_DOC
{@inheritDoc}
.public static final JavadocTagInfo LINK
{@link}
.public static final JavadocTagInfo LINKPLAIN
{@linkplain}
.public static final JavadocTagInfo LITERAL
{@literal}
.public static final JavadocTagInfo PARAM
@param
.public static final JavadocTagInfo RETURN
@return
.public static final JavadocTagInfo SEE
@see
.public static final JavadocTagInfo SERIAL
@serial
.public static final JavadocTagInfo SERIAL_DATA
@serialData
.public static final JavadocTagInfo SERIAL_FIELD
@serialField
.public static final JavadocTagInfo SINCE
@since
.public static final JavadocTagInfo THROWS
@throws
.public static final JavadocTagInfo VALUE
{@value}
.public static final JavadocTagInfo VERSION
@version
.private static final int[] DEF_TOKEN_TYPES_DEPRECATED
private static final int[] DEF_TOKEN_TYPES
private static final java.util.Map<java.lang.String,JavadocTagInfo> TEXT_TO_TAG
private static final java.util.Map<java.lang.String,JavadocTagInfo> NAME_TO_TAG
private final java.lang.String text
private final java.lang.String name
private final JavadocTagInfo.Type type
public static JavadocTagInfo[] values()
for (JavadocTagInfo c : JavadocTagInfo.values()) System.out.println(c);
public static JavadocTagInfo valueOf(java.lang.String name)
name
- the name of the enum constant to be returned.java.lang.IllegalArgumentException
- if this enum type has no constant with the specified namejava.lang.NullPointerException
- if the argument is nullpublic abstract boolean isValidOn(DetailAST ast)
If passing in a DetailAST representing a non-void METHOD_DEF
true
would be returned. If passing in a DetailAST
representing a CLASS_DEF false
would be returned because
CLASS_DEF's cannot return a value.
ast
- the AST representing a type that can be Javadoc'dpublic java.lang.String getText()
public java.lang.String getName()
public JavadocTagInfo.Type getType()
Type
.public static JavadocTagInfo fromText(java.lang.String text)
text
- String representing the tag textjava.lang.NullPointerException
- if the text is nulljava.lang.IllegalArgumentException
- if the text is not a valid tagpublic static JavadocTagInfo fromName(java.lang.String name)
name
- String name of the tagjava.lang.NullPointerException
- if the text is nulljava.lang.IllegalArgumentException
- if the text is not a valid tag. The name
can be checked using isValidName(String)
public static boolean isValidName(java.lang.String name)
name
- the tag name to check.public java.lang.String toString()
toString
in class java.lang.Enum<JavadocTagInfo>