EMMA Coverage Report (generated Sat Feb 02 18:43:55 MSK 2008)
[all classes][net.sourceforge.retroweaver.runtime.java.lang.reflect]

COVERAGE SUMMARY FOR SOURCE FILE [Constructor_.java]

nameclass, %method, %block, %line, %
Constructor_.java100% (1/1)25%  (2/8)19%  (18/96)29%  (4/14)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class Constructor_100% (1/1)25%  (2/8)19%  (18/96)29%  (4/14)
Constructor_ (): void 0%   (0/1)0%   (0/3)0%   (0/2)
getAnnotation (Constructor, Class): Annotation 0%   (0/1)0%   (0/22)0%   (0/2)
getAnnotations (Constructor): Annotation [] 0%   (0/1)0%   (0/3)0%   (0/1)
getDeclaredAnnotations (Constructor): Annotation [] 0%   (0/1)0%   (0/21)0%   (0/2)
getParameterAnnotations (Constructor): Annotation [][] 0%   (0/1)0%   (0/21)0%   (0/2)
isAnnotationPresent (Constructor, Class): boolean 0%   (0/1)0%   (0/8)0%   (0/1)
isSynthetic (Constructor): boolean 100% (1/1)100% (9/9)100% (2/2)
isVarArgs (Constructor): boolean 100% (1/1)100% (9/9)100% (2/2)

1package net.sourceforge.retroweaver.runtime.java.lang.reflect;
2 
3import static org.objectweb.asm.Opcodes.ACC_SYNTHETIC;
4import static org.objectweb.asm.Opcodes.ACC_VARARGS;
5 
6import java.lang.reflect.Constructor;
7import java.lang.reflect.Method;
8 
9import net.sourceforge.retroweaver.runtime.java.lang.annotation.AIB;
10import net.sourceforge.retroweaver.runtime.java.lang.annotation.Annotation;
11 
12/**
13 * A mirror of java.lang.reflect.Constructor. Unfortunately, although this class
14 * is almost a direct copy of Method_, there's not an easy way to share the
15 * implementation between the two, because Method and Constructor don't have any
16 * sort of typed relationship.
17 * 
18 * @author Toby Reyelts Date: Feb 21, 2005 Time: 2:40:01 AM
19 */
20public class Constructor_ {
21 
22        private Constructor_() {
23                // private constructor
24        }
25 
26        // Returns this element's annotation for the specified type if such an
27        // annotation is present, else null.
28        public static <T extends Annotation> T getAnnotation(final Constructor cons, final Class<T> annotationType) {
29                final Class c = cons.getDeclaringClass();
30                return AIB.getAib(c).getMethodAnnotation(cons.getName(), cons.getParameterTypes(), Void.class, annotationType);
31        }
32 
33        // Returns all annotations present on this element.
34        //
35        // We have to search superclasses and interfaces, looking for annotations
36        // which are meta-annotated with the @Inherited Annotation.
37        // (Yuk)
38        //
39        public static Annotation[] getAnnotations(final Constructor cons) {
40                return getDeclaredAnnotations(cons);
41        }
42 
43        // Returns all annotations that are directly present on this element.
44        public static Annotation[] getDeclaredAnnotations(final Constructor cons) {
45                final Class c = cons.getDeclaringClass();
46                return AIB.getAib(c).getMethodAnnotations(cons.getName(), cons.getParameterTypes(), Void.class);
47        }
48 
49        // Returns true if an annotation for the specified type is present on this
50        // element, else false.
51        public static boolean isAnnotationPresent(final Constructor cons, final Class<? extends Annotation> annotationType) {
52                return getAnnotation(cons, annotationType) != null;
53        }
54 
55        public static Annotation[][] getParameterAnnotations(final Constructor cons) {
56                final Class c = cons.getDeclaringClass();
57                return AIB.getAib(c).getMethodParameterAnnotations(cons.getName(), cons.getParameterTypes(), Void.class);
58        }
59 
60        // Returns true if this constructor was declared to take a variable number of arguments; returns false otherwise.
61        public static boolean isVarArgs(final Constructor cons) {
62                final Class c = cons.getDeclaringClass();
63                return ReflectionDescriptor.getReflectionDescriptor(c).testConstructorAccess(cons, ACC_VARARGS);
64        }
65 
66        // Returns true if this constructor is a synthetic constructor; returns false otherwise.
67        public static boolean isSynthetic(final Constructor cons) {
68                final Class c = cons.getDeclaringClass();
69                return ReflectionDescriptor.getReflectionDescriptor(c).testConstructorAccess(cons, ACC_SYNTHETIC);
70        }
71 
72}

[all classes][net.sourceforge.retroweaver.runtime.java.lang.reflect]
EMMA 2.0.8001 (unsupported private build) (C) Vladimir Roubtsov