private static <T extends Annotation> Ann<T> pickAnn( Class<? extends Ann<T>> annCls, Ann<T>[] anns) { for (Ann<?> ann : anns) { if (ann.getClass().isAssignableFrom(annCls)) { @SuppressWarnings("unchecked") Ann<T> typedAnn = (Ann<T>) ann; return typedAnn; } } return null; }
@Override protected Object getVal(Context ctx, View root, Object target, Ann<?> ann, Field field) throws Exception { boolean handled = false; Class<?> annType = ann.getClass(); Object val = null; if (annType == InjectFragmentAnn.class) { handled = true; if (useSupport()) { val = SupportFragmentReader.getVal(target, (InjectFragmentAnn) ann, field); } else { val = NativeFragmentReader.getVal(target, (InjectFragmentAnn) ann, field); } } else if (annType == InjectParentActivityAnn.class) { handled = true; if (useSupport()) { val = SupportParentActivityReader.getVal(target); } else { val = NativeParentActivityReader.getVal(target); } } return handled ? val : super.getVal(ctx, root, target, ann, field); }