@Override public void enrich(final SearchContext searchContext, Object target) { List<Field> fields = FindByUtilities.getListOfFieldsAnnotatedWithFindBys(target); for (Field field : fields) { GrapheneContext grapheneContext = searchContext == null ? null : ((GrapheneProxyInstance) searchContext) .getGrapheneContext(); final SearchContext localSearchContext; if (grapheneContext == null) { grapheneContext = GrapheneContext.getContextFor(ReflectionHelper.getQualifier(field.getAnnotations())); localSearchContext = grapheneContext.getWebDriver(SearchContext.class); } else { localSearchContext = searchContext; } // Page fragment if (isPageFragmentClass(field.getType(), target)) { setupPageFragment(localSearchContext, target, field); // List<Page fragment> } else { try { if (field.getType().isAssignableFrom(List.class) && isPageFragmentClass(getListType(field), target)) { setupPageFragmentList(localSearchContext, target, field); } } catch (ClassNotFoundException e) { throw new PageFragmentInitializationException(e.getMessage(), e); } } } }
@Override public void enrich(final SearchContext searchContext, Object target) { List<Field> fields = FindByUtilities.getListOfFieldsAnnotatedWithFindBys(target); for (Field field : fields) { GrapheneContext grapheneContext = searchContext == null ? null : ((GrapheneProxyInstance) searchContext) .getGrapheneContext(); final SearchContext localSearchContext; if (grapheneContext == null) { grapheneContext = GrapheneContext.getContextFor(ReflectionHelper.getQualifier(field.getAnnotations())); localSearchContext = grapheneContext.getWebDriver(SearchContext.class); } else { localSearchContext = searchContext; } // Page fragment if (isPageFragmentClass(field.getType(), target)) { setupPageFragment(localSearchContext, target, field); // List<Page fragment> } else { try { if (field.getType().isAssignableFrom(List.class) && isPageFragmentClass(getListType(field), target)) { setupPageFragmentList(localSearchContext, target, field); } } catch (ClassNotFoundException e) { throw new PageFragmentInitializationException(e.getMessage(), e); } } } }