Tests if the specified Doc
element has a tag of the specified kind
and, possibly, with the specified text argument.
Parameters:
element
TheDoc
element whose tag is requested.It may be also a
Type
element, which is automatically converted to theClassDoc
by calling the Doclet API method:Type.asClassDoc()
If the
element
is not an instance ofDoc
orType
type, the function returnsfalse
.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 withArray()
function). For example:In that case, the function will test if the specifiedhasTag(Array("@mytag1", "@mytag2"))
Doc
element has a tag corresponding to at least one of the specified tag kinds.
text
Specify a text argument the tag must have.See Also: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:will returnhasTag("@serial", "include")
true
if the currentDoc
element has a comment like this:/** * ... * @serial include */
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:
is equivalent to:hasTag("@serial", "include")
or to:hasChild ( "Tag", BooleanQuery ( hasAttrValue("kind", "@serial") && hasAttrValue("text", text) ) )
However, those alternatives will work much slower and cannot be applied directly tocheckValueByLPath ( 'Tag[hasAttrValue("kind", "@serial")]/@text', test )
Type
elements (for instance, in the last expression,
a different location path will be needed).