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

The Doc element whose tags are requested.

This may be also:

If the element is not an instance of one of those types, the function returns null.

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 with Array() function). For example:
findTag(Array("@mytag1", "@mytag2"))
In that case, the function will search for the first tag name, then, if not found, for the second and so on.

Returns:

The element identifier of the found tag or null if no tag found.

To convert the returned identifier to the Tag element, use findElementById() function, e.g.:


findElementById(findTag("@mytag"))
See Also:
tag(), hasTag(), GOMElement.id, findElementById()