1 19 20 package asm2; 21 22 import java.io.IOException ; 23 import java.io.InputStream ; 24 import java.net.URL ; 25 import java.util.List ; 26 27 28 public class AnnotatedClass { 29 private AnnReader r; 30 31 public AnnotatedClass(Class c) { 32 try { 33 URL u = c.getResource("/"+ 34 c.getName().replace('.', '/')+".class"); 35 r = new AnnReader(u.openStream()); 36 } catch(IOException ex) { 37 throw new RuntimeException (ex.toString()); 38 } 39 } 40 41 public AnnotatedClass(InputStream is) { 42 try { 43 r = new AnnReader(is); 44 } catch(IOException ex) { 45 throw new RuntimeException (ex.toString()); 46 } 47 } 48 49 public Ann[] getAnnotations() { 50 List anns = r.getClassAnnotations(); 51 return (Ann[]) anns.toArray(new Ann[0]); 52 } 53 54 public Ann getAnnotation(Class c) { 55 throw new RuntimeException ("Not implemented"); 56 } 57 58 public boolean isAnnotationPresent(Class c) { 59 throw new RuntimeException ("Not implemented"); 60 } 61 62 public AnnotatedMethod[] getMethods() { 63 throw new RuntimeException ("Not implemented"); 64 } 65 66 public AnnotatedField[] getFields() { 67 throw new RuntimeException ("Not implemented"); 68 } 69 70 } 71 72 | Popular Tags |