當前位置: 首頁>>代碼示例>>Java>>正文


Java SuperReflect類代碼示例

本文整理匯總了Java中de.jodamob.reflect.SuperReflect的典型用法代碼示例。如果您正苦於以下問題:Java SuperReflect類的具體用法?Java SuperReflect怎麽用?Java SuperReflect使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


SuperReflect類屬於de.jodamob.reflect包,在下文中一共展示了SuperReflect類的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: toList

import de.jodamob.reflect.SuperReflect; //導入依賴的package包/類
static <T> List<T> toList(PickleTable dataTable, Type itemType, JsonElement testData) {
    List<T> result = new ArrayList<T>();
    List<String> keys = convertTopCellsToFieldNames(raw(dataTable.getRows().get(0)));
    int count = dataTable.getRows().size();
    for (int i = 1; i < count; i++) {
        List<String> valueRow = raw(dataTable.getRows().get(i));
        T item = (T) SuperReflect.on((Class) itemType).create().get();
        int j = 0;
        for (String cell : valueRow) {
            SuperReflect.on(item).set(keys.get(j), cell);
            j++;
        }
        result.add(item);
    }
    return Collections.unmodifiableList(result);
}
 
開發者ID:andrewjc,項目名稱:kheera-testrunner-android,代碼行數:17,代碼來源:TableConverter.java

示例2: waitUntilBottomSheetDisplayed

import de.jodamob.reflect.SuperReflect; //導入依賴的package包/類
private void waitUntilBottomSheetDisplayed() {
    MaterialActivityChooserActivity activityChooserActivity = ActivityUtils.getCurrentActivity(mActivityRule);
    BottomSheetBehavior.BottomSheetCallback originalBottomSheetCallback = SuperReflect.on(activityChooserActivity).get("mBottomSheetCallback");
    if (!(originalBottomSheetCallback instanceof IdlingResourceBottomSheetCallback)) {
        final BottomSheetBehavior bottomSheetBehavior = SuperReflect.on(activityChooserActivity)
                .get("mBottomSheetBehavior");

        /* The bottom sheet gets opened with a delay (using Handler#postDelayed())
         * therefore we need to initially wait for the bottom sheet to get to the 'collapsed' state
         */
        await().until(new Callable<Boolean>() {
            @Override
            public Boolean call() throws Exception {
                return bottomSheetBehavior.getState() == BottomSheetBehavior.STATE_COLLAPSED;
            }
        });
        mIdlingResourceBottomSheetCallback = new IdlingResourceBottomSheetCallback(originalBottomSheetCallback, mBottomSheetIdlingResource);
        bottomSheetBehavior.setBottomSheetCallback(mIdlingResourceBottomSheetCallback);
    }
    onView(withId(R.id.mac_bottom_sheet)).check(matches(isDisplayed()));
}
 
開發者ID:zawadz88,項目名稱:material-activity-chooser,代碼行數:22,代碼來源:SampleListStepDefinitions.java

示例3: bindForTests

import de.jodamob.reflect.SuperReflect; //導入依賴的package包/類
private void bindForTests(Object instanceWithViews) {
    SuperReflect reflector = SuperReflect.on(instanceWithViews);
    Class<?> instanceWithViewsClass = instanceWithViews.getClass();
    do {
        bindAllViews(reflector, instanceWithViewsClass);
        instanceWithViewsClass = instanceWithViewsClass.getSuperclass();
    } while (!instanceWithViewsClass.isAssignableFrom(Object.class));
}
 
開發者ID:dpreussler,項目名稱:Diacetyl,代碼行數:9,代碼來源:Diacetyl.java

示例4: bindAllViews

import de.jodamob.reflect.SuperReflect; //導入依賴的package包/類
private void bindAllViews(SuperReflect reflector, Class<?> instanceWithViewsClass) {
    Field[] fields = instanceWithViewsClass.getDeclaredFields();
    for (Field field : fields) {
        if (isView(field)) {
            tryToMockView(reflector, field);
        }
    }
}
 
開發者ID:dpreussler,項目名稱:Diacetyl,代碼行數:9,代碼來源:Diacetyl.java

示例5: tryToSet

import de.jodamob.reflect.SuperReflect; //導入依賴的package包/類
private void tryToSet(SuperReflect reflector, Field field, Object mock) {
    try {
        reflector.setIfNull(field.getName(), mock);
    } catch (Exception e) {
        e.printStackTrace();
    }
}
 
開發者ID:dpreussler,項目名稱:Diacetyl,代碼行數:8,代碼來源:Diacetyl.java

示例6: tryToMockView

import de.jodamob.reflect.SuperReflect; //導入依賴的package包/類
private void tryToMockView(SuperReflect reflector, Field field) {
    tryToSet(reflector, field, getMockFor(field.getType()));
}
 
開發者ID:dpreussler,項目名稱:Diacetyl,代碼行數:4,代碼來源:Diacetyl.java


注:本文中的de.jodamob.reflect.SuperReflect類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。