Tests if the specified Doc element has a tag of the specified kind and, possibly, with the specified text argument.

Parameters:

element

The Doc element whose tag is requested.

It may be also a Type element, which is automatically converted to the ClassDoc by calling the Doclet API method: Type.asClassDoc()

If the element is not an instance of Doc or Type type, the function returns false.

If this parameter is not specified, the generator context element is assumed, i.e. the same as the call: contextElement.hasTag(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:
hasTag(Array("@mytag1", "@mytag2"))
In that case, the function will test if the specified Doc element has a tag corresponding to at least one of the specified tag kinds.
text
Specify a text argument the tag must have.

When this parameter is specified, the function returns true only if the element not only has tags of the specified kind, but also at least one of them has a text argument equal to the string specified in this parameter. For example, the expression:

hasTag("@serial", "include")
will return true if the current Doc element has a comment like this:

/**
 * ...
 * @serial include
 */
See Also:
tag(), tags()

Alternatives:

The result returned by hasTag() function can be equally achieved with different means.

For example when applied to a Doc element, the call:

hasTag("@serial", "include")
is equivalent to:

hasChild (
  "Tag",
  BooleanQuery (
    hasAttrValue("kind", "@serial") &&
    hasAttrValue("text", text)
  )
)
or to:

checkValueByLPath (
  'Tag[hasAttrValue("kind", "@serial")]/@text',
  test
)
However, those alternatives will work much slower and cannot be applied directly to Type elements (for instance, in the last expression, a different location path will be needed).