For 1107 -- Annotations

I added a class for RequestForEnhancement and
added a reflection API to display it -- But all I get
is the reviewer again??

 I used getDeclaredAnnotation() which is supposed
to get the method annotations for the Class??

===================================================
Reflected with:

Annotation[] declaredAnnotations = c.getDeclaredAnnotations();
int numberDeclaredAnnotations = declaredAnnotations.length;
System.out.println("Class " + c.getName() + " has " +
       numberDeclaredAnnotations + " declaredAnnotations");
        
for (int i = 0 ; i < numberDeclaredAnnotations; i++) {
       System.out.println("Annotation " + i + ": " +                    
declaredAnnotations[i] +  ", type" + 
declaredAnnotations[i].annotationType().getName());
}

=========================================================
Claas Defined:

import java.lang.annotation.*;

@Retention(RetentionPolicy.RUNTIME)
public @interface RequestForEnhancement {
    int id();
    String synopsis();
    String engineer() default "[unassigned]";
    String date()     default "[unimplemented]";
}

====================================================
Used as: 
    
@RequestForEnhancement(id=120, synopsis="Test Version",   engineer="Thornton", 
date="Jan 1,2009")
   public void setId(int id) {
        this.id = id;
    }

Help would be appreciated!

Chuck T.



-- 
Competency and chastity have much in common,
they both encompass their own punishment! 
 
-- C.E. Thornton -- Hawthorne Press --


--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/javaprogrammingwithpassion?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to