Results 1 to 8 of 8
- 05-14-2011, 08:16 AM #1
Member
- Join Date
- Feb 2011
- Posts
- 4
- Rep Power
- 0
Reading an annotaion that is ElementType.LOCAL_VARIABLE
I have been trying read a ElementType.LOCAL_VARIABLE annotation using reflect package.
Here is my annotation:
@Target(value={ElementType.TYPE,ElementType.LOCAL_ VARIABLE})
@Retention(value=RetentionPolicy.RUNTIME)
public @interface TestAnnotation{
String theName();
}
Here is my program to try read the annotation:
public class TestTheAnnotation{
public static void main(String[] args){
@TestAnnotation(theName="My_LastName,My_FirstName" )
Integer id=new Integer(1);
System.out.println(">> "+id.getClass().getAnnotations().length);
System.out.println(">> "+id.getClass().getDeclaredAnnotations().lengt h);
}
}
The methods getAnnotations, and getDeclaredAnnotations only return the annotations declared for the object, but I want the annotation declared for the local variable.
Is there any way to do this?
Thanks.
- 05-14-2011, 08:49 AM #2
- 05-14-2011, 06:56 PM #3
Member
- Join Date
- Feb 2011
- Posts
- 4
- Rep Power
- 0
Are http://www.java-forums.org and http://forums.oracle.com the same system?
- 05-14-2011, 08:19 PM #4
Nope.
db
- 05-19-2011, 08:17 PM #5
Member
- Join Date
- Apr 2011
- Posts
- 69
- Rep Power
- 0
If they are not the same system what is wrong with posting in multiple forums? Do you spend your days looking at other forums to see if people post the same questions?!
- 05-20-2011, 03:39 AM #6
Yup.
db
-
There's nothing wrong with cross-posting per se, but we don't appreciate cross-posts without notification. To see why this is important, please read this link: BeForthrightWhenCrossPostingToOtherSites. Thank you in advance for reading the link and responding in an understanding manner.
- 05-20-2011, 12:11 PM #8
Member
- Join Date
- Apr 2011
- Posts
- 69
- Rep Power
- 0
Similar Threads
-
Reading log
By Darth Blue Ray in forum New To JavaReplies: 1Last Post: 03-15-2011, 09:35 PM -
Reading doc file
By siva_vs_siva in forum New To JavaReplies: 1Last Post: 09-03-2010, 11:20 AM -
reading from a .txt
By Flamespewer in forum New To JavaReplies: 1Last Post: 09-14-2009, 08:35 AM -
problem with reading excel sheet data reading using poi libraries
By sandeepsai17 in forum New To JavaReplies: 5Last Post: 08-21-2009, 11:03 AM -
Reading Keyboard
By ushigley in forum New To JavaReplies: 4Last Post: 08-20-2008, 01:50 PM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks