Finds a tag of the specified kind in the specified Doc
element and all classes containing it.
The function works as the following.
Initially, it searches for the tag directly in the specified
Doc
element
(or a Doc
element to which the specified element
immediately leads; see element
parameter for details).
If the tag is found the function returns it.
If the tag is not found and the initial element is
a program element (that is an instance of
com.sun.javadoc.ProgramElementDoc
interface,
which represents a Java class or a class member),
the search is continued in the class containing that program element.
This will repeat until the tag is found or a top (non-inner) class is reached.
This function may be particularly useful when some tags specified in a class affect processing of the class' members and its inner classes.
For instance, when for a given method you need to know if either the method itself or the class containing it has a certain tag, you may test it using the following expression:
method.findTag("@mytag") != null
Parameters:
element
TheDoc
element whose tags are requested.This may be also:
If the
- A
Type
element, which is automatically converted to theClassDoc
by calling the Doclet API method:Type.asClassDoc()
- An
AnnotationDesc
element, which is automatically converted to theAnnotationTypeDoc
by calling the Doclet API method:AnnotationTypeDoc.annotationType()
element
is not an instance of one of those types, the function returnsnull
.If this parameter is not specified, the generator context element is assumed, i.e. the same as the call:
contextElement.findTag(tagName)
tagName
The name of the tag kind to search for.
tagNames
Instead of a single tag kind name, you may specify several names in the form of an array (e.g. created withArray()
function). For example:In that case, the function will search for the first tag name, then, if not found, for the second and so on.findTag(Array("@mytag1", "@mytag2"))
Returns:
The element identifier of the found tag orSee Also:null
if no tag found.To convert the returned identifier to the
Tag
element, usefindElementById()
function, e.g.:findElementById(findTag("@mytag"))
tag(), hasTag(), GOMElement.id, findElementById()