View RSS Feed

My Java Tips

Categories of annotations

Rate this Entry
by , 10-31-2011 at 04:57 PM (1279 Views)
There are three categories of annotations namely Marker, Single-Value and Full annotation.


Let me present these one by one:

Marker annotations

There annotations have no variables. These are identified by name, with no additional data supplied. For example:
Code:


@SingleValueAnnotation

Single-value annotations

These are similar to markers, but also provide a single piece of data. You can only provide a single bit of data with these. For example:
Code:

Java Code:
@SingleValueAnnotation("my data")
Full annotations

There have multiple data members. Annotations of this type won’t look quite so much like a normal Java method:


Java Code:
@FullAnnotation(var1="data value 1", var2="data value 2", var3="data value 3")

Submit "Categories of annotations" to Facebook Submit "Categories of annotations" to Digg Submit "Categories of annotations" to del.icio.us Submit "Categories of annotations" to StumbleUpon Submit "Categories of annotations" to Google

Tags: None Add / Edit Tags
Categories
Annotations

Comments