コード例 #1
0
ファイル: TestClass.java プロジェクト: BinSlashBash/xcrumby
 public <T> List<T> getAnnotatedFieldValues(
     Object paramObject, Class<? extends Annotation> paramClass, Class<T> paramClass1) {
   ArrayList localArrayList = new ArrayList();
   paramClass = getAnnotatedFields(paramClass).iterator();
   while (paramClass.hasNext()) {
     Object localObject = (FrameworkField) paramClass.next();
     try {
       localObject = ((FrameworkField) localObject).get(paramObject);
       if (paramClass1.isInstance(localObject)) {
         localArrayList.add(paramClass1.cast(localObject));
       }
     } catch (IllegalAccessException paramObject) {
       throw new RuntimeException(
           "How did getFields return a field we couldn't access?", (Throwable) paramObject);
     }
   }
   return localArrayList;
 }
コード例 #2
0
ファイル: TestClass.java プロジェクト: BinSlashBash/xcrumby
 public TestClass(Class<?> paramClass) {
   this.fClass = paramClass;
   if ((paramClass != null) && (paramClass.getConstructors().length > 1)) {
     throw new IllegalArgumentException("Test class can only have one constructor");
   }
   paramClass = getSuperClasses(this.fClass).iterator();
   while (paramClass.hasNext()) {
     Object localObject = (Class) paramClass.next();
     Method[] arrayOfMethod = MethodSorter.getDeclaredMethods((Class) localObject);
     int j = arrayOfMethod.length;
     int i = 0;
     while (i < j) {
       addToAnnotationLists(new FrameworkMethod(arrayOfMethod[i]), this.fMethodsForAnnotations);
       i += 1;
     }
     localObject = ((Class) localObject).getDeclaredFields();
     j = localObject.length;
     i = 0;
     while (i < j) {
       addToAnnotationLists(new FrameworkField(localObject[i]), this.fFieldsForAnnotations);
       i += 1;
     }
   }
 }