<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="ru">
		<id>http://www.jexp.ru/index.php?action=history&amp;feed=atom&amp;title=Java%2FLanguage_Basics%2FAnnotation</id>
		<title>Java/Language Basics/Annotation - История изменений</title>
		<link rel="self" type="application/atom+xml" href="http://www.jexp.ru/index.php?action=history&amp;feed=atom&amp;title=Java%2FLanguage_Basics%2FAnnotation"/>
		<link rel="alternate" type="text/html" href="http://www.jexp.ru/index.php?title=Java/Language_Basics/Annotation&amp;action=history"/>
		<updated>2026-04-23T02:41:41Z</updated>
		<subtitle>История изменений этой страницы в вики</subtitle>
		<generator>MediaWiki 1.30.0</generator>

	<entry>
		<id>http://www.jexp.ru/index.php?title=Java/Language_Basics/Annotation&amp;diff=7497&amp;oldid=prev</id>
		<title>Admin: 1 версия</title>
		<link rel="alternate" type="text/html" href="http://www.jexp.ru/index.php?title=Java/Language_Basics/Annotation&amp;diff=7497&amp;oldid=prev"/>
				<updated>2010-06-01T06:47:01Z</updated>
		
		<summary type="html">&lt;p&gt;1 версия&lt;/p&gt;
&lt;table class=&quot;diff diff-contentalign-left&quot; data-mw=&quot;interface&quot;&gt;
				&lt;tr style=&quot;vertical-align: top;&quot; lang=&quot;ru&quot;&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;← Предыдущая&lt;/td&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;Версия 06:47, 1 июня 2010&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; style=&quot;text-align: center;&quot; lang=&quot;ru&quot;&gt;&lt;div class=&quot;mw-diff-empty&quot;&gt;(нет различий)&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;</summary>
		<author><name>Admin</name></author>	</entry>

	<entry>
		<id>http://www.jexp.ru/index.php?title=Java/Language_Basics/Annotation&amp;diff=7496&amp;oldid=prev</id>
		<title> в 18:01, 31 мая 2010</title>
		<link rel="alternate" type="text/html" href="http://www.jexp.ru/index.php?title=Java/Language_Basics/Annotation&amp;diff=7496&amp;oldid=prev"/>
				<updated>2010-05-31T18:01:45Z</updated>
		
		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Новая страница&lt;/b&gt;&lt;/p&gt;&lt;div&gt;== A marker annotation.  ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;!-- start source code --&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
    &amp;lt;source lang=&amp;quot;java&amp;quot;&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
import java.lang.annotation.*; &lt;br /&gt;
import java.lang.reflect.*; &lt;br /&gt;
 &lt;br /&gt;
@Retention(RetentionPolicy.RUNTIME)  &lt;br /&gt;
@interface MyMarker { } &lt;br /&gt;
 &lt;br /&gt;
public class Marker { &lt;br /&gt;
 &lt;br /&gt;
  // Annotate a method using a marker. &lt;br /&gt;
  // Notice that no ( ) is needed. &lt;br /&gt;
  @MyMarker &lt;br /&gt;
  public static void myMeth() { &lt;br /&gt;
    Marker ob = new Marker(); &lt;br /&gt;
 &lt;br /&gt;
    try { &lt;br /&gt;
      Method m = ob.getClass().getMethod(&amp;quot;myMeth&amp;quot;); &lt;br /&gt;
 &lt;br /&gt;
      // Determine if the annotation is present. &lt;br /&gt;
      if(m.isAnnotationPresent(MyMarker.class)) &lt;br /&gt;
        System.out.println(&amp;quot;MyMarker is present.&amp;quot;);  &lt;br /&gt;
 &lt;br /&gt;
    } catch (NoSuchMethodException exc) { &lt;br /&gt;
       System.out.println(&amp;quot;Method Not Found.&amp;quot;); &lt;br /&gt;
    } &lt;br /&gt;
  } &lt;br /&gt;
 &lt;br /&gt;
  public static void main(String args[]) { &lt;br /&gt;
    myMeth(); &lt;br /&gt;
  } &lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
           &lt;br /&gt;
         &lt;br /&gt;
  &amp;lt;/source&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;!-- end source code --&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== An annotation type declaration.  ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;!-- start source code --&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
    &amp;lt;source lang=&amp;quot;java&amp;quot;&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
/*&lt;br /&gt;
Java 2, v5.0 (Tiger) New Features&lt;br /&gt;
by Herbert Schildt&lt;br /&gt;
ISBN: 0072258543&lt;br /&gt;
Publisher: McGraw-Hill/Osborne, 2004&lt;br /&gt;
*/&lt;br /&gt;
import java.lang.annotation.*; &lt;br /&gt;
import java.lang.reflect.*; &lt;br /&gt;
 &lt;br /&gt;
@Retention(RetentionPolicy.RUNTIME)  &lt;br /&gt;
@interface MyAnno { &lt;br /&gt;
  String str(); &lt;br /&gt;
  int val(); &lt;br /&gt;
} &lt;br /&gt;
 &lt;br /&gt;
public class Meta { &lt;br /&gt;
 &lt;br /&gt;
  // Annotate a method. &lt;br /&gt;
  @MyAnno(str = &amp;quot;Annotation Example&amp;quot;, val = 100) &lt;br /&gt;
  public static void myMeth() { &lt;br /&gt;
    Meta ob = new Meta(); &lt;br /&gt;
 &lt;br /&gt;
    // Obtain the annotation for this method &lt;br /&gt;
    // and display the values of the members. &lt;br /&gt;
    try { &lt;br /&gt;
      // First, get a Class object that represents &lt;br /&gt;
      // this class. &lt;br /&gt;
      Class c = ob.getClass(); &lt;br /&gt;
 &lt;br /&gt;
      // Now, get a Method object that represents &lt;br /&gt;
      // this method. &lt;br /&gt;
      Method m = c.getMethod(&amp;quot;myMeth&amp;quot;); &lt;br /&gt;
 &lt;br /&gt;
      // Next, get the annotation for this class. &lt;br /&gt;
      MyAnno anno = m.getAnnotation(MyAnno.class); &lt;br /&gt;
  &lt;br /&gt;
      // Finally, display the values. &lt;br /&gt;
      System.out.println(anno.str() + &amp;quot; &amp;quot; + anno.val()); &lt;br /&gt;
    } catch (NoSuchMethodException exc) { &lt;br /&gt;
       System.out.println(&amp;quot;Method Not Found.&amp;quot;); &lt;br /&gt;
    } &lt;br /&gt;
  } &lt;br /&gt;
 &lt;br /&gt;
  public static void main(String args[]) { &lt;br /&gt;
    myMeth(); &lt;br /&gt;
  } &lt;br /&gt;
}&lt;br /&gt;
           &lt;br /&gt;
         &lt;br /&gt;
  &amp;lt;/source&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;!-- end source code --&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== An annotation type declaration 2. ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;!-- start source code --&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
    &amp;lt;source lang=&amp;quot;java&amp;quot;&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
/*&lt;br /&gt;
Java 2, v5.0 (Tiger) New Features&lt;br /&gt;
by Herbert Schildt&lt;br /&gt;
ISBN: 0072258543&lt;br /&gt;
Publisher: McGraw-Hill/Osborne, 2004&lt;br /&gt;
*/&lt;br /&gt;
import java.lang.annotation.*; &lt;br /&gt;
import java.lang.reflect.*; &lt;br /&gt;
 &lt;br /&gt;
@Retention(RetentionPolicy.RUNTIME)  &lt;br /&gt;
@interface MyAnno { &lt;br /&gt;
  String str(); &lt;br /&gt;
  int val(); &lt;br /&gt;
} &lt;br /&gt;
 &lt;br /&gt;
public class Meta1 { &lt;br /&gt;
 &lt;br /&gt;
  // myMeth now has two arguments. &lt;br /&gt;
  @MyAnno(str = &amp;quot;Two Parameters&amp;quot;, val = 19) &lt;br /&gt;
  public static void myMeth(String str, int i)  &lt;br /&gt;
  { &lt;br /&gt;
    Meta1 ob = new Meta1(); &lt;br /&gt;
 &lt;br /&gt;
    try { &lt;br /&gt;
      Class c = ob.getClass(); &lt;br /&gt;
 &lt;br /&gt;
      // Here, the parameter types are specified. &lt;br /&gt;
      Method m = c.getMethod(&amp;quot;myMeth&amp;quot;, String.class, int.class); &lt;br /&gt;
 &lt;br /&gt;
      MyAnno anno = m.getAnnotation(MyAnno.class); &lt;br /&gt;
  &lt;br /&gt;
      System.out.println(anno.str() + &amp;quot; &amp;quot; + anno.val()); &lt;br /&gt;
    } catch (NoSuchMethodException exc) { &lt;br /&gt;
       System.out.println(&amp;quot;Method Not Found.&amp;quot;); &lt;br /&gt;
    } &lt;br /&gt;
  } &lt;br /&gt;
 &lt;br /&gt;
  public static void main(String args[]) { &lt;br /&gt;
    myMeth(&amp;quot;test&amp;quot;, 10); &lt;br /&gt;
  } &lt;br /&gt;
}           &lt;br /&gt;
         &lt;br /&gt;
  &amp;lt;/source&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;!-- end source code --&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== An annotation type declaration and include defaults.  ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;!-- start source code --&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
    &amp;lt;source lang=&amp;quot;java&amp;quot;&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
import java.lang.annotation.*; &lt;br /&gt;
import java.lang.reflect.*; &lt;br /&gt;
 &lt;br /&gt;
@Retention(RetentionPolicy.RUNTIME)  &lt;br /&gt;
@interface MyAnno { &lt;br /&gt;
  String str() default &amp;quot;Testing&amp;quot;; &lt;br /&gt;
  int val() default 9000; &lt;br /&gt;
} &lt;br /&gt;
 &lt;br /&gt;
public class Meta3 { &lt;br /&gt;
 &lt;br /&gt;
  // Annotate a method using the default values. &lt;br /&gt;
  @MyAnno() &lt;br /&gt;
  public static void myMeth() { &lt;br /&gt;
    Meta3 ob = new Meta3(); &lt;br /&gt;
 &lt;br /&gt;
    // Obtain the annotation for this method &lt;br /&gt;
    // and display the values of the members. &lt;br /&gt;
    try { &lt;br /&gt;
      Class c = ob.getClass(); &lt;br /&gt;
 &lt;br /&gt;
      Method m = c.getMethod(&amp;quot;myMeth&amp;quot;); &lt;br /&gt;
 &lt;br /&gt;
      MyAnno anno = m.getAnnotation(MyAnno.class); &lt;br /&gt;
  &lt;br /&gt;
      System.out.println(anno.str() + &amp;quot; &amp;quot; + anno.val()); &lt;br /&gt;
    } catch (NoSuchMethodException exc) { &lt;br /&gt;
       System.out.println(&amp;quot;Method Not Found.&amp;quot;); &lt;br /&gt;
    } &lt;br /&gt;
  } &lt;br /&gt;
 &lt;br /&gt;
  public static void main(String args[]) { &lt;br /&gt;
    myMeth(); &lt;br /&gt;
  } &lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
           &lt;br /&gt;
         &lt;br /&gt;
  &amp;lt;/source&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;!-- end source code --&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Annotation Demo ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;!-- start source code --&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
    &amp;lt;source lang=&amp;quot;java&amp;quot;&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
public class StringUtility {&lt;br /&gt;
@TestParameters(testStage=&amp;quot;Unit&amp;quot;,&lt;br /&gt;
                testMethods=&amp;quot;testConcat,testSubstring&amp;quot;,&lt;br /&gt;
                testOutputType=&amp;quot;screen&amp;quot;,&lt;br /&gt;
                testOutput=&amp;quot;&amp;quot;)&lt;br /&gt;
    public String concat(String s1, String s2)&lt;br /&gt;
    {&lt;br /&gt;
        return(s1 + s2);&lt;br /&gt;
    }&lt;br /&gt;
    public String substring(String str, int start, int end)&lt;br /&gt;
    {&lt;br /&gt;
        return(str.substring(start, end));&lt;br /&gt;
    }&lt;br /&gt;
    public boolean testConcat()&lt;br /&gt;
    {&lt;br /&gt;
        String s1 = &amp;quot;test&amp;quot;;&lt;br /&gt;
        String s2 = &amp;quot; 123&amp;quot;;&lt;br /&gt;
        return(concat(s1,s2).equals(&amp;quot;test 123&amp;quot;));&lt;br /&gt;
    }&lt;br /&gt;
    public boolean testSubstring()&lt;br /&gt;
    {&lt;br /&gt;
        String str = &amp;quot;The cat landed on its feet&amp;quot;;&lt;br /&gt;
        return(substring(str, 4, 3).equals(&amp;quot;cat&amp;quot;));&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
           &lt;br /&gt;
         &lt;br /&gt;
  &amp;lt;/source&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;!-- end source code --&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Annotation Viewer ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;!-- start source code --&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
    &amp;lt;source lang=&amp;quot;java&amp;quot;&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
import com.sun.javadoc.*;&lt;br /&gt;
import java.lang.annotation.*;&lt;br /&gt;
public class AnnotationViewer {&lt;br /&gt;
    public static boolean start(RootDoc root)&lt;br /&gt;
    {&lt;br /&gt;
        ClassDoc[] classes = root.classes();&lt;br /&gt;
        for (ClassDoc cls : classes) {&lt;br /&gt;
            showAnnotations(cls);&lt;br /&gt;
        }&lt;br /&gt;
        return(true);&lt;br /&gt;
    }&lt;br /&gt;
    static void showAnnotations(ClassDoc cls)&lt;br /&gt;
    {&lt;br /&gt;
        System.out.println(&amp;quot;Annotations for class [&amp;quot; + cls + &amp;quot;]&amp;quot;);&lt;br /&gt;
        process(cls.annotations());&lt;br /&gt;
        System.out.println();&lt;br /&gt;
        for(MethodDoc m : cls.methods()) {&lt;br /&gt;
            System.out.println(&amp;quot;Annotations for method [&amp;quot; + m + &amp;quot;]&amp;quot;);&lt;br /&gt;
            process(m.annotations());&lt;br /&gt;
            System.out.println();&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
    static void process(AnnotationDesc[] anns)&lt;br /&gt;
    {&lt;br /&gt;
        for (AnnotationDesc ad : anns) {&lt;br /&gt;
            AnnotationDesc.ElementValuePair evp[] = ad.elementValues();&lt;br /&gt;
            for(AnnotationDesc.ElementValuePair e : evp) {&lt;br /&gt;
                System.out.println(&amp;quot;  NAME: &amp;quot; + e.element() + &amp;quot;, VALUE=&amp;quot; + e.value());&lt;br /&gt;
            }&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
           &lt;br /&gt;
         &lt;br /&gt;
  &amp;lt;/source&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;!-- end source code --&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== A single member annotation.  ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;!-- start source code --&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
    &amp;lt;source lang=&amp;quot;java&amp;quot;&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
import java.lang.annotation.*; &lt;br /&gt;
import java.lang.reflect.*; &lt;br /&gt;
 &lt;br /&gt;
@Retention(RetentionPolicy.RUNTIME)  &lt;br /&gt;
@interface MySingle { &lt;br /&gt;
  int value(); // this variable name must be value &lt;br /&gt;
} &lt;br /&gt;
 &lt;br /&gt;
public class Single { &lt;br /&gt;
 &lt;br /&gt;
  // Annotate a method using a marker. &lt;br /&gt;
  @MySingle(100) &lt;br /&gt;
  public static void myMeth() { &lt;br /&gt;
    Single ob = new Single(); &lt;br /&gt;
 &lt;br /&gt;
    try { &lt;br /&gt;
      Method m = ob.getClass().getMethod(&amp;quot;myMeth&amp;quot;); &lt;br /&gt;
 &lt;br /&gt;
      MySingle anno = m.getAnnotation(MySingle.class); &lt;br /&gt;
 &lt;br /&gt;
      System.out.println(anno.value()); // displays 100 &lt;br /&gt;
 &lt;br /&gt;
    } catch (NoSuchMethodException exc) { &lt;br /&gt;
       System.out.println(&amp;quot;Method Not Found.&amp;quot;); &lt;br /&gt;
    } &lt;br /&gt;
  } &lt;br /&gt;
 &lt;br /&gt;
  public static void main(String args[]) { &lt;br /&gt;
    myMeth(); &lt;br /&gt;
  } &lt;br /&gt;
}&lt;br /&gt;
           &lt;br /&gt;
         &lt;br /&gt;
  &amp;lt;/source&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;!-- end source code --&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== How do I mark method as deprecated? ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;!-- start source code --&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
    &amp;lt;source lang=&amp;quot;java&amp;quot;&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
import java.util.Calendar;&lt;br /&gt;
import java.util.Date;&lt;br /&gt;
public class Main {&lt;br /&gt;
  public static void main(String[] args) {&lt;br /&gt;
    getDate();&lt;br /&gt;
    getMonthFromDate();&lt;br /&gt;
  }&lt;br /&gt;
  /**&lt;br /&gt;
   * Get current system date.&lt;br /&gt;
   * &lt;br /&gt;
   * @return current system date.&lt;br /&gt;
   * @deprecated This method will removed in the near future.&lt;br /&gt;
   */&lt;br /&gt;
  @Deprecated&lt;br /&gt;
  public static Date getDate() {&lt;br /&gt;
    return new Date();&lt;br /&gt;
  }&lt;br /&gt;
  public static int getMonthFromDate() {&lt;br /&gt;
    return Calendar.getInstance().get(Calendar.MONTH);&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;/source&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;!-- end source code --&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Insert an annotation to suppress warning ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;!-- start source code --&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
    &amp;lt;source lang=&amp;quot;java&amp;quot;&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
import java.util.ArrayList;&lt;br /&gt;
import java.util.Iterator;&lt;br /&gt;
public class Main {&lt;br /&gt;
  @SuppressWarnings(&amp;quot;unchecked&amp;quot;)&lt;br /&gt;
  public static void main(String[] args) {&lt;br /&gt;
    ArrayList data = new ArrayList();&lt;br /&gt;
    data.add(&amp;quot;hello&amp;quot;);&lt;br /&gt;
    data.add(&amp;quot;world&amp;quot;);&lt;br /&gt;
    Iterator it = data.iterator();&lt;br /&gt;
    while (it.hasNext()) {&lt;br /&gt;
      System.out.println(it.next());&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;/source&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;!-- end source code --&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Java Annotation: Annotation and Reflection ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;!-- start source code --&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
    &amp;lt;source lang=&amp;quot;java&amp;quot;&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
/*&lt;br /&gt;
License for Java 1.5 &amp;quot;Tiger&amp;quot;: A Developer&amp;quot;s Notebook&lt;br /&gt;
     (O&amp;quot;Reilly) example package&lt;br /&gt;
Java 1.5 &amp;quot;Tiger&amp;quot;: A Developer&amp;quot;s Notebook (O&amp;quot;Reilly) &lt;br /&gt;
by Brett McLaughlin and David Flanagan.&lt;br /&gt;
ISBN: 0-596-00738-8&lt;br /&gt;
You can use the examples and the source code any way you want, but&lt;br /&gt;
please include a reference to where it comes from if you use it in&lt;br /&gt;
your own products or services. Also note that this software is&lt;br /&gt;
provided by the author &amp;quot;as is&amp;quot;, with no expressed or implied warranties. &lt;br /&gt;
In no event shall the author be liable for any direct or indirect&lt;br /&gt;
damages arising in any way out of the use of this software.&lt;br /&gt;
*/&lt;br /&gt;
import java.io.IOException;&lt;br /&gt;
import java.io.PrintStream;&lt;br /&gt;
import java.lang.reflect.AnnotatedElement;&lt;br /&gt;
import java.lang.annotation.Annotation;&lt;br /&gt;
import java.util.Date;&lt;br /&gt;
import java.lang.annotation.Documented;&lt;br /&gt;
import java.lang.annotation.Inherited;&lt;br /&gt;
import java.lang.annotation.Retention;&lt;br /&gt;
import java.lang.annotation.RetentionPolicy;&lt;br /&gt;
public class ReflectionTester {&lt;br /&gt;
  public ReflectionTester() {&lt;br /&gt;
  }&lt;br /&gt;
  public void testAnnotationPresent(PrintStream out) throws IOException {&lt;br /&gt;
    Class c = Super.class;&lt;br /&gt;
    boolean inProgress = c.isAnnotationPresent(InProgress.class);&lt;br /&gt;
    if (inProgress) {&lt;br /&gt;
      out.println(&amp;quot;Super is In Progress&amp;quot;);&lt;br /&gt;
    } else {&lt;br /&gt;
      out.println(&amp;quot;Super is not In Progress&amp;quot;);&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
  public void testInheritedAnnotation(PrintStream out) throws IOException {&lt;br /&gt;
    Class c = Sub.class;&lt;br /&gt;
    boolean inProgress = c.isAnnotationPresent(InProgress.class);&lt;br /&gt;
    if (inProgress) {&lt;br /&gt;
      out.println(&amp;quot;Sub is In Progress&amp;quot;);&lt;br /&gt;
    } else {&lt;br /&gt;
      out.println(&amp;quot;Sub is not In Progress&amp;quot;);&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
  public void testGetAnnotation(PrintStream out) &lt;br /&gt;
    throws IOException, NoSuchMethodException {&lt;br /&gt;
    Class c = AnnotationTester.class;&lt;br /&gt;
    AnnotatedElement element = c.getMethod(&amp;quot;calculateInterest&amp;quot;, &lt;br /&gt;
                                  float.class, float.class);&lt;br /&gt;
    GroupTODO groupTodo = element.getAnnotation(GroupTODO.class);&lt;br /&gt;
    String assignedTo = groupTodo.assignedTo();&lt;br /&gt;
    out.println(&amp;quot;TODO Item on Annotation Tester is assigned to: &amp;quot;&amp;quot; + &lt;br /&gt;
        assignedTo + &amp;quot;&amp;quot;&amp;quot;);&lt;br /&gt;
  }&lt;br /&gt;
  public void printAnnotations(AnnotatedElement e, PrintStream out)&lt;br /&gt;
    throws IOException {&lt;br /&gt;
    out.printf(&amp;quot;Printing annotations for &amp;quot;%s&amp;quot;%n%n&amp;quot;, e.toString());&lt;br /&gt;
    Annotation[] annotations = e.getAnnotations();&lt;br /&gt;
    for (Annotation a : annotations) {&lt;br /&gt;
      out.printf(&amp;quot;    * Annotation &amp;quot;%s&amp;quot; found%n&amp;quot;, &lt;br /&gt;
        a.annotationType().getName());&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
  public static void main(String[] args) {&lt;br /&gt;
    try {&lt;br /&gt;
      ReflectionTester tester = new ReflectionTester();&lt;br /&gt;
      tester.testAnnotationPresent(System.out);&lt;br /&gt;
      tester.testInheritedAnnotation(System.out);&lt;br /&gt;
      tester.testGetAnnotation(System.out);&lt;br /&gt;
      Class c = AnnotationTester.class;&lt;br /&gt;
      AnnotatedElement element = c.getMethod(&amp;quot;calculateInterest&amp;quot;, &lt;br /&gt;
                                    float.class, float.class);      &lt;br /&gt;
      tester.printAnnotations(element, System.out);&lt;br /&gt;
    } catch (Exception e) {&lt;br /&gt;
      e.printStackTrace();&lt;br /&gt;
    } &lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
class Sub extends Super {&lt;br /&gt;
  public void print(PrintStream out) throws IOException {&lt;br /&gt;
    out.println(&amp;quot;Sub printing...&amp;quot;);&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
@InProgress class Super {&lt;br /&gt;
  public void print(PrintStream out) throws IOException {&lt;br /&gt;
    out.println(&amp;quot;Super printing...&amp;quot;);&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
@Documented&lt;br /&gt;
@Retention(RetentionPolicy.RUNTIME)&lt;br /&gt;
@interface GroupTODO {&lt;br /&gt;
  public enum Severity { CRITICAL, IMPORTANT, TRIVIAL, DOCUMENTATION };&lt;br /&gt;
  Severity severity() default Severity.IMPORTANT;&lt;br /&gt;
  String item();&lt;br /&gt;
  String assignedTo();&lt;br /&gt;
  String dateAssigned();&lt;br /&gt;
}&lt;br /&gt;
/**&lt;br /&gt;
 * Marker annotation to indicate that a method or class&lt;br /&gt;
 *   is still in progress.&lt;br /&gt;
 */&lt;br /&gt;
@Documented&lt;br /&gt;
@Inherited&lt;br /&gt;
@Retention(RetentionPolicy.RUNTIME)&lt;br /&gt;
@interface InProgress { }&lt;br /&gt;
           &lt;br /&gt;
         &lt;br /&gt;
  &amp;lt;/source&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;!-- end source code --&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Java Annotation: Deprecated and hierarchy ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;!-- start source code --&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
    &amp;lt;source lang=&amp;quot;java&amp;quot;&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
/*&lt;br /&gt;
License for Java 1.5 &amp;quot;Tiger&amp;quot;: A Developer&amp;quot;s Notebook&lt;br /&gt;
     (O&amp;quot;Reilly) example package&lt;br /&gt;
Java 1.5 &amp;quot;Tiger&amp;quot;: A Developer&amp;quot;s Notebook (O&amp;quot;Reilly) &lt;br /&gt;
by Brett McLaughlin and David Flanagan.&lt;br /&gt;
ISBN: 0-596-00738-8&lt;br /&gt;
You can use the examples and the source code any way you want, but&lt;br /&gt;
please include a reference to where it comes from if you use it in&lt;br /&gt;
your own products or services. Also note that this software is&lt;br /&gt;
provided by the author &amp;quot;as is&amp;quot;, with no expressed or implied warranties. &lt;br /&gt;
In no event shall the author be liable for any direct or indirect&lt;br /&gt;
damages arising in any way out of the use of this software.&lt;br /&gt;
*/&lt;br /&gt;
&lt;br /&gt;
public class DeprecatedTester extends DeprecatedClass {&lt;br /&gt;
  public void doSomething() {&lt;br /&gt;
    // Overrides a deprecated method&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
class DeprecatedClass {&lt;br /&gt;
  /**&lt;br /&gt;
   * This method has now been deprecated in favor of doSomethingElse()&lt;br /&gt;
   * @deprecated Use doSomethingElse() instead&lt;br /&gt;
   */&lt;br /&gt;
  @Deprecated public void doSomething() {&lt;br /&gt;
    // Really... do something...&lt;br /&gt;
  }&lt;br /&gt;
  public void doSomethingElse() {&lt;br /&gt;
    // Do something else (and presumably better)&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
           &lt;br /&gt;
         &lt;br /&gt;
  &amp;lt;/source&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;!-- end source code --&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Java annotation: Super Sub Tester ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;!-- start source code --&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
    &amp;lt;source lang=&amp;quot;java&amp;quot;&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
/*&lt;br /&gt;
License for Java 1.5 &amp;quot;Tiger&amp;quot;: A Developer&amp;quot;s Notebook&lt;br /&gt;
     (O&amp;quot;Reilly) example package&lt;br /&gt;
Java 1.5 &amp;quot;Tiger&amp;quot;: A Developer&amp;quot;s Notebook (O&amp;quot;Reilly) &lt;br /&gt;
by Brett McLaughlin and David Flanagan.&lt;br /&gt;
ISBN: 0-596-00738-8&lt;br /&gt;
You can use the examples and the source code any way you want, but&lt;br /&gt;
please include a reference to where it comes from if you use it in&lt;br /&gt;
your own products or services. Also note that this software is&lt;br /&gt;
provided by the author &amp;quot;as is&amp;quot;, with no expressed or implied warranties. &lt;br /&gt;
In no event shall the author be liable for any direct or indirect&lt;br /&gt;
damages arising in any way out of the use of this software.&lt;br /&gt;
*/&lt;br /&gt;
import java.io.*;&lt;br /&gt;
public class SuperSubTester {&lt;br /&gt;
  public static void main(String[] args) {&lt;br /&gt;
    try {&lt;br /&gt;
      Sub sub = new Sub();&lt;br /&gt;
      sub.print(System.out);&lt;br /&gt;
    } catch (Exception e) {&lt;br /&gt;
      e.printStackTrace();&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
class Sub extends Super {&lt;br /&gt;
  public void print(PrintStream out) throws IOException {&lt;br /&gt;
    out.println(&amp;quot;Sub printing...&amp;quot;);&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
@InProgress class Super {&lt;br /&gt;
  public void print(PrintStream out) throws IOException {&lt;br /&gt;
    out.println(&amp;quot;Super printing...&amp;quot;);&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
           &lt;br /&gt;
         &lt;br /&gt;
  &amp;lt;/source&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;!-- end source code --&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Java Annotation Tester ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;!-- start source code --&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
    &amp;lt;source lang=&amp;quot;java&amp;quot;&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
/*&lt;br /&gt;
License for Java 1.5 &amp;quot;Tiger&amp;quot;: A Developer&amp;quot;s Notebook&lt;br /&gt;
     (O&amp;quot;Reilly) example package&lt;br /&gt;
Java 1.5 &amp;quot;Tiger&amp;quot;: A Developer&amp;quot;s Notebook (O&amp;quot;Reilly) &lt;br /&gt;
by Brett McLaughlin and David Flanagan.&lt;br /&gt;
ISBN: 0-596-00738-8&lt;br /&gt;
You can use the examples and the source code any way you want, but&lt;br /&gt;
please include a reference to where it comes from if you use it in&lt;br /&gt;
your own products or services. Also note that this software is&lt;br /&gt;
provided by the author &amp;quot;as is&amp;quot;, with no expressed or implied warranties. &lt;br /&gt;
In no event shall the author be liable for any direct or indirect&lt;br /&gt;
damages arising in any way out of the use of this software.&lt;br /&gt;
*/&lt;br /&gt;
import java.lang.annotation.Documented;&lt;br /&gt;
import java.lang.annotation.Inherited;&lt;br /&gt;
import java.lang.annotation.Retention;&lt;br /&gt;
import java.lang.annotation.RetentionPolicy;&lt;br /&gt;
&lt;br /&gt;
public class AnnotationTester {&lt;br /&gt;
  @InProgress&lt;br /&gt;
  @GroupTODO(&lt;br /&gt;
    severity=GroupTODO.Severity.CRITICAL,&lt;br /&gt;
    item=&amp;quot;Figure out the amount of interest per month&amp;quot;,&lt;br /&gt;
    assignedTo=&amp;quot;Brett McLaughlin&amp;quot;,&lt;br /&gt;
    dateAssigned=&amp;quot;04-26-2004&amp;quot;&lt;br /&gt;
  )&lt;br /&gt;
  public void calculateInterest(float amount, float rate) {&lt;br /&gt;
    // Need to finish this method later&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
/**&lt;br /&gt;
 * Marker annotation to indicate that a method or class&lt;br /&gt;
 *   is still in progress.&lt;br /&gt;
 */&lt;br /&gt;
@Documented&lt;br /&gt;
@Inherited&lt;br /&gt;
@Retention(RetentionPolicy.RUNTIME)&lt;br /&gt;
@interface InProgress { }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
@Documented&lt;br /&gt;
@Retention(RetentionPolicy.RUNTIME)&lt;br /&gt;
@interface GroupTODO {&lt;br /&gt;
  public enum Severity { CRITICAL, IMPORTANT, TRIVIAL, DOCUMENTATION };&lt;br /&gt;
  Severity severity() default Severity.IMPORTANT;&lt;br /&gt;
  String item();&lt;br /&gt;
  String assignedTo();&lt;br /&gt;
  String dateAssigned();&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
           &lt;br /&gt;
         &lt;br /&gt;
  &amp;lt;/source&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;!-- end source code --&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Override Annotation Tester ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;!-- start source code --&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
    &amp;lt;source lang=&amp;quot;java&amp;quot;&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
/*&lt;br /&gt;
License for Java 1.5 &amp;quot;Tiger&amp;quot;: A Developer&amp;quot;s Notebook&lt;br /&gt;
     (O&amp;quot;Reilly) example package&lt;br /&gt;
Java 1.5 &amp;quot;Tiger&amp;quot;: A Developer&amp;quot;s Notebook (O&amp;quot;Reilly) &lt;br /&gt;
by Brett McLaughlin and David Flanagan.&lt;br /&gt;
ISBN: 0-596-00738-8&lt;br /&gt;
You can use the examples and the source code any way you want, but&lt;br /&gt;
please include a reference to where it comes from if you use it in&lt;br /&gt;
your own products or services. Also note that this software is&lt;br /&gt;
provided by the author &amp;quot;as is&amp;quot;, with no expressed or implied warranties. &lt;br /&gt;
In no event shall the author be liable for any direct or indirect&lt;br /&gt;
damages arising in any way out of the use of this software.&lt;br /&gt;
*/&lt;br /&gt;
public class OverrideTester {&lt;br /&gt;
  public OverrideTester() { }&lt;br /&gt;
  @Override&lt;br /&gt;
  public String toString() {&lt;br /&gt;
    return super.toString() + &amp;quot; [OverrideTester Implementation]&amp;quot;;&lt;br /&gt;
  }&lt;br /&gt;
  @Override&lt;br /&gt;
  public int hashCode() {&lt;br /&gt;
    return toString().hashCode();&lt;br /&gt;
  }&lt;br /&gt;
  /**&lt;br /&gt;
   * Uncomment to see @Override in action on a misspelled method&lt;br /&gt;
  @Override&lt;br /&gt;
  public int hasCode() {&lt;br /&gt;
    return toString().hashCode();&lt;br /&gt;
  }&lt;br /&gt;
  */&lt;br /&gt;
}&lt;br /&gt;
           &lt;br /&gt;
         &lt;br /&gt;
  &amp;lt;/source&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;!-- end source code --&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Show all annotations for a class and a method. ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;!-- start source code --&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
    &amp;lt;source lang=&amp;quot;java&amp;quot;&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
import java.lang.annotation.*; &lt;br /&gt;
import java.lang.reflect.*; &lt;br /&gt;
 &lt;br /&gt;
@Retention(RetentionPolicy.RUNTIME)  &lt;br /&gt;
@interface MyAnno { &lt;br /&gt;
  String str(); &lt;br /&gt;
  int val(); &lt;br /&gt;
} &lt;br /&gt;
 &lt;br /&gt;
@Retention(RetentionPolicy.RUNTIME)  &lt;br /&gt;
@interface What { &lt;br /&gt;
  String description(); &lt;br /&gt;
} &lt;br /&gt;
 &lt;br /&gt;
@What(description = &amp;quot;An annotation test class&amp;quot;) &lt;br /&gt;
@MyAnno(str = &amp;quot;Meta2&amp;quot;, val = 99) &lt;br /&gt;
public class Meta2 { &lt;br /&gt;
 &lt;br /&gt;
  @What(description = &amp;quot;An annotation test method&amp;quot;) &lt;br /&gt;
  @MyAnno(str = &amp;quot;Testing&amp;quot;, val = 100) &lt;br /&gt;
  public static void myMeth() { &lt;br /&gt;
    Meta2 ob = new Meta2(); &lt;br /&gt;
 &lt;br /&gt;
    try { &lt;br /&gt;
      Annotation annos[] = ob.getClass().getAnnotations(); &lt;br /&gt;
 &lt;br /&gt;
      // Display all annotations for Meta2. &lt;br /&gt;
      System.out.println(&amp;quot;All annotations for Meta2:&amp;quot;); &lt;br /&gt;
      for(Annotation a : annos) &lt;br /&gt;
        System.out.println(a); &lt;br /&gt;
 &lt;br /&gt;
      System.out.println(); &lt;br /&gt;
 &lt;br /&gt;
      // Display all annotations for myMeth. &lt;br /&gt;
      Method m = ob.getClass( ).getMethod(&amp;quot;myMeth&amp;quot;); &lt;br /&gt;
      annos = m.getAnnotations();  &lt;br /&gt;
 &lt;br /&gt;
      System.out.println(&amp;quot;All annotations for myMeth:&amp;quot;); &lt;br /&gt;
      for(Annotation a : annos) &lt;br /&gt;
        System.out.println(a); &lt;br /&gt;
 &lt;br /&gt;
    } catch (NoSuchMethodException exc) { &lt;br /&gt;
       System.out.println(&amp;quot;Method Not Found.&amp;quot;); &lt;br /&gt;
    } &lt;br /&gt;
  } &lt;br /&gt;
 &lt;br /&gt;
  public static void main(String args[]) { &lt;br /&gt;
    myMeth(); &lt;br /&gt;
  } &lt;br /&gt;
}&lt;br /&gt;
           &lt;br /&gt;
         &lt;br /&gt;
  &amp;lt;/source&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;!-- end source code --&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Simple annotation ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;!-- start source code --&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
    &amp;lt;source lang=&amp;quot;java&amp;quot;&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
/*&lt;br /&gt;
License for Java 1.5 &amp;quot;Tiger&amp;quot;: A Developer&amp;quot;s Notebook&lt;br /&gt;
     (O&amp;quot;Reilly) example package&lt;br /&gt;
Java 1.5 &amp;quot;Tiger&amp;quot;: A Developer&amp;quot;s Notebook (O&amp;quot;Reilly) &lt;br /&gt;
by Brett McLaughlin and David Flanagan.&lt;br /&gt;
ISBN: 0-596-00738-8&lt;br /&gt;
You can use the examples and the source code any way you want, but&lt;br /&gt;
please include a reference to where it comes from if you use it in&lt;br /&gt;
your own products or services. Also note that this software is&lt;br /&gt;
provided by the author &amp;quot;as is&amp;quot;, with no expressed or implied warranties. &lt;br /&gt;
In no event shall the author be liable for any direct or indirect&lt;br /&gt;
damages arising in any way out of the use of this software.&lt;br /&gt;
*/&lt;br /&gt;
&lt;br /&gt;
import java.lang.annotation.Documented;&lt;br /&gt;
import java.lang.annotation.ElementType;&lt;br /&gt;
import java.lang.annotation.Retention;&lt;br /&gt;
import java.lang.annotation.RetentionPolicy;&lt;br /&gt;
import java.lang.annotation.Target;&lt;br /&gt;
/**&lt;br /&gt;
 * Annotation type to indicate a task still needs to&lt;br /&gt;
 *   be completed.&lt;br /&gt;
 */&lt;br /&gt;
@Documented&lt;br /&gt;
@Retention(RetentionPolicy.RUNTIME)&lt;br /&gt;
@Target({ElementType.TYPE,&lt;br /&gt;
         ElementType.METHOD, &lt;br /&gt;
         ElementType.CONSTRUCTOR, &lt;br /&gt;
         ElementType.ANNOTATION_TYPE})&lt;br /&gt;
public @interface TODO { &lt;br /&gt;
  String value();&lt;br /&gt;
}&lt;br /&gt;
           &lt;br /&gt;
         &lt;br /&gt;
  &amp;lt;/source&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;!-- end source code --&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Suppress warning in ANT script ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;!-- start source code --&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
    &amp;lt;source lang=&amp;quot;java&amp;quot;&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
&amp;lt;target name=&amp;quot;compile&amp;quot;&amp;gt;&lt;br /&gt;
       &amp;lt;javac srcdir=&amp;quot;${src}&amp;quot; destdir=&amp;quot;${bin}&amp;quot; &lt;br /&gt;
              includeAntRuntime=&amp;quot;no&amp;quot; &lt;br /&gt;
              debug=&amp;quot;${compile.debug}&amp;quot;&amp;gt;&lt;br /&gt;
           &amp;lt;compilerarg value=&amp;quot;-Xlint:unchecked&amp;quot;/&amp;gt;&lt;br /&gt;
       &amp;lt;/javac&amp;gt;&lt;br /&gt;
&amp;lt;/target&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;/source&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;!-- end source code --&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== SuppressWarnings Annotation Tester ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;!-- start source code --&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
    &amp;lt;source lang=&amp;quot;java&amp;quot;&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
/*&lt;br /&gt;
License for Java 1.5 &amp;quot;Tiger&amp;quot;: A Developer&amp;quot;s Notebook&lt;br /&gt;
     (O&amp;quot;Reilly) example package&lt;br /&gt;
Java 1.5 &amp;quot;Tiger&amp;quot;: A Developer&amp;quot;s Notebook (O&amp;quot;Reilly) &lt;br /&gt;
by Brett McLaughlin and David Flanagan.&lt;br /&gt;
ISBN: 0-596-00738-8&lt;br /&gt;
You can use the examples and the source code any way you want, but&lt;br /&gt;
please include a reference to where it comes from if you use it in&lt;br /&gt;
your own products or services. Also note that this software is&lt;br /&gt;
provided by the author &amp;quot;as is&amp;quot;, with no expressed or implied warranties. &lt;br /&gt;
In no event shall the author be liable for any direct or indirect&lt;br /&gt;
damages arising in any way out of the use of this software.&lt;br /&gt;
*/&lt;br /&gt;
import java.util.ArrayList;&lt;br /&gt;
import java.util.List;&lt;br /&gt;
public class SuppressWarningsTester {&lt;br /&gt;
  /**&lt;br /&gt;
   * Normal pre-1.5 method body&lt;br /&gt;
   */&lt;br /&gt;
  @SuppressWarnings(value={&amp;quot;unchecked&amp;quot;})&lt;br /&gt;
  public void nonGenericsMethod() {&lt;br /&gt;
    List wordList = new ArrayList();&lt;br /&gt;
    wordList.add(&amp;quot;foo&amp;quot;);&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
           &lt;br /&gt;
         &lt;br /&gt;
  &amp;lt;/source&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;!-- end source code --&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Use Override annotation ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;!-- start source code --&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
    &amp;lt;source lang=&amp;quot;java&amp;quot;&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
public class Main {&lt;br /&gt;
  private String field;&lt;br /&gt;
  private String attribute;&lt;br /&gt;
  @Override&lt;br /&gt;
  public int hashCode() {&lt;br /&gt;
    return field.hashCode() + attribute.hashCode();&lt;br /&gt;
  }&lt;br /&gt;
  @Override&lt;br /&gt;
  public String toString() {&lt;br /&gt;
    return field + &amp;quot; &amp;quot; + attribute;&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;/source&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;!-- end source code --&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== What is SuppressWarnings annotation? ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;!-- start source code --&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
    &amp;lt;source lang=&amp;quot;java&amp;quot;&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
import java.util.Date;&lt;br /&gt;
 &lt;br /&gt;
public class Main {&lt;br /&gt;
    @SuppressWarnings(value={&amp;quot;deprecation&amp;quot;})&lt;br /&gt;
    public static void main(String[] args) {&lt;br /&gt;
        Date date = new Date(2009, 9, 30);&lt;br /&gt;
 &lt;br /&gt;
        System.out.println(&amp;quot;date = &amp;quot; + date);&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;/source&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;!-- end source code --&amp;gt;&lt;/div&gt;</summary>
			</entry>

	</feed>