vm/src/test/java/org/apidesign/vm4brwsr/Classes.java
branchreflection
changeset 261 5d1e20215d12
parent 237 84ffc347412d
child 264 ed0c92c81ea4
     1.1 --- a/vm/src/test/java/org/apidesign/vm4brwsr/Classes.java	Sun Dec 02 14:01:17 2012 +0100
     1.2 +++ b/vm/src/test/java/org/apidesign/vm4brwsr/Classes.java	Tue Dec 04 14:49:01 2012 +0100
     1.3 @@ -19,6 +19,7 @@
     1.4  
     1.5  import java.io.IOException;
     1.6  import java.lang.annotation.Annotation;
     1.7 +import java.lang.reflect.Method;
     1.8  import java.net.MalformedURLException;
     1.9  
    1.10  /**
    1.11 @@ -41,6 +42,7 @@
    1.12          return new IOException().getClass().getName().toString();
    1.13      }
    1.14      
    1.15 +    @ClassesMarker(number = 1)
    1.16      public static String name() {
    1.17          return IOException.class.getName().toString();
    1.18      }
    1.19 @@ -76,4 +78,21 @@
    1.20          }
    1.21          return null;
    1.22      }
    1.23 +    
    1.24 +    public static Object reflectiveMethodCall(boolean direct) throws Exception {
    1.25 +        Method m;
    1.26 +        /*
    1.27 +        if (!direct) {
    1.28 +            final Class<? extends Annotation> v = ClassesMarker.class;
    1.29 +            for (Method single : Classes.class.getMethods()) {
    1.30 +                if (single.getAnnotation(v)) {
    1.31 +                    m = single;
    1.32 +                    break;
    1.33 +                }
    1.34 +            }
    1.35 +        } else*/ {
    1.36 +            m = Classes.class.getMethod("name");
    1.37 +        }
    1.38 +        return m.invoke(null);
    1.39 +    }
    1.40  }