A tag is a piece of meta data to associate the annotated element with a non-hierarchical keyword or term. The annotated element may be assigned to zero or more tags.
Annotations found at the type level (i.e. a Java class) are inherited to the elements defined in this type.
This is a filing element.
The following examples show how the DocTag annotation can be used.
The examples show the tag names as string literals. Please consider using constants that define these values. This way it is easier to ensure that the tags are correctly spelled and also may be changed later more easily.
The annotation is provided at element level and associates the given tags to that element only.
public interface ExampleInterface { @DocTag({ "sample-tag" }) String element(); }
The tag sample-tag is assigned to the Element element.
The annotation allows to reference a collection of tags.
public interface ExampleInterface { @DocTag({ "sample-tag one", "sample-tag two", "sample-tag three" }) String element(); }
The tags sample-tag one, sample-tag two, and sample-tag three are assigned to the Element element.
Tags specified at type level will be inherited to the elements.
@DocTag("parent-tag") public interface TestProperties { String inheritAll(); @DocTag({ "sample-tag one" }) String oneValue(); @DocTag({ "sample-tag one", "sample-tag two", "sample-tag three" }) String multipleValues(); }
The element inheritAll is tagged with the tag parent-tag, the element oneValue is tagged with parent-tag and sample-tag one and the element multipleValues is tagged with four tags (the one provided by the tag at type level and its own three tags).