当前位置: 首页>>代码示例>>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;未经允许,请勿转载。