>This then gives us three ways to use it.
>
[quoted text clipped - 14 lines]
>The difference between 2 and 3 are whether the text appears in the
>source file. Both will include the text in the javadocs.

Signature
Bush crime family lost/embezzled $3 trillion from Pentagon.
Complicit Bush-friendly media keeps mum. Rumsfeld confesses on video.
http://www.infowars.com/articles/us/mckinney_grills_rumsfeld.htm
Canadian Mind Products, Roedy Green.
See http://mindprod.com/iraq.html photos of Bush's war crimes
>>This then gives us three ways to use it.
>>
[quoted text clipped - 19 lines]
>
> Annotations are used in the form @interface or @Retention.
They are declared using @interface. They are used by using @ and the
name of the annotation. Retention is an annotation that you apply to
another annotation to specify how long the annotation is maintained.
> These are
> annotations, a feature of JDK 1.5+. You can use them to add metadata
[quoted text clipped - 3 lines]
> the attribute static, declaring a class, variable or method to be
> marked with a given annotation.
They can serve man different purposes. Java itself uses some for its own
purposes. For example there is the @Override annotation to specify that
a method has to override a method in the superclass or the compiler
generates an error.
They are kind of like marker interfaces except that they actually can
contain some simple data.
> These @annotations not JavaDoc tags! They are part of the program
> proper.
Yes. In fact there is a Deprecated annotation that can be used instead
of the @deprecated java doc tags.
> @Retention(RetentionPolicy.RUNTIME) means the following annotation
> should be retained in the class files.
Yes. In addition to being retained in the class file it can be read at
runtime using reflection. With RetentionPolicy.CLASS the information is
discarded when the class is read into the VM.
> @Target(ElementType.METHOD) means the following annotation only
> applies to methods in the class, not the whole class.
It means that the annotation can only be used on method declarations.
> @Documents means the following annotation should show up in the
> JavaDoc
It's @Documented, not @Documents, but yes.
> // this code lives is a file called CopyrightCanadianMindproducts.java
>
[quoted text clipped - 14 lines]
>
> Now that you have defined it, you can annotate any class with it,
Since, you didn't declare a Target annotation on it you can annotate
anything with it.
> which embeds the copyright notice in the class file, with otherwise
> changing the class file. Here is how you use it:
And you can also read it using reflection at runtime. Do you really need
to do that? If not, then would use RetentionPolicy.CLASS.
> // @CopyrightCanadianMindProducts now behaves like other modifiers
> // such as public or static. It can be used to tag a class,
> // embedding the copyright notice, but otherwise not changing the
> class.
> @CopyrightCanadianMindProducts public class MyClass1{ ... }
Yes. This will embed the defaultCopyright in the class file. The javdocs
will only say @CopyrightCanadianMindProducts.
> // Or I can tag a class with a slightly different copyright notice,
> // but still using the CopyrightCanadianMindProducts tag name.
[quoted text clipped - 6 lines]
> }
> public class MyClass2{ ... }
No, it's parentheses not braces.
And in this case the javadocs will contain the text that you specify.
> // Or I can be explicit that I am using the default
> @CopyrightCanadianMindProducts
> {
> CopyrightCanadianMindProducts.defaultCopyright
> }
> public class MyClass3{ ... }
Once again, its parentheses not braces. This will also include the text
in the javadocs.
> J:\Program Files\java\jdk1.5.0_04\docs\guide\language\annotations.html
This link might work a little better for others ;-)
http://java.sun.com/j2se/1.5.0/docs/guide/language/annotations.html

Signature
Dale King