Hi,
I don't know about M5 but I can confirm you that annotations and
isAnnotationPresent work great in the next SDK. I recently used this
method successfully.
On Mon, Apr 7, 2008 at 4:15 AM, srakyi <[EMAIL PROTECTED]> wrote:
>
> Are reflection methods like
> java.lang.reflect.AccessibleObject.isAnnotationPresent() implemented?
>
> Here is my example:
>
> -- i have this simple annotation:
> import java.lang.annotation.ElementType;
> import java.lang.annotation.Retention;
> import java.lang.annotation.RetentionPolicy;
> import java.lang.annotation.Target;
>
> @Retention(RetentionPolicy.RUNTIME)
> @Target(ElementType.METHOD)
> public @interface GSTestAnn {
>
> }
>
> -- i have this class:
> public class GSTest {
> @GSTestAnn
> public void annotated() {
> // empty
> }
> }
>
> -- and finally this block of code:
> GSTest test = new GSTest();
> for (Method m : test.getClass().getMethods()) {
> if (m.isAnnotationPresent(GSTestAnn.class)) {
> log("is in : " + m.getName()); }
> else {
> log("NOT in : " + m.getName());
> }
> }
>
> If i run this example outside Android, everything works and name of
> method "annotated()" is prefixed by "is in" in log. But if I run it
> inside Android, all methods (including "annotated()") are prefixed
> with "NOT in" .. does it mean that it isn't implemented? (it's same
> for other reflection methods as well)
>
> Thanks for any advice,
>
> srakyi
>
> >
>
--
Romain Guy
www.curious-creature.org
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[EMAIL PROTECTED]
Announcing the new M5 SDK!
http://android-developers.blogspot.com/2008/02/android-sdk-m5-rc14-now-available.html
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---