private <T extends PageObject> void invokePostConstructMethods(
     T pageInstance, Class<T> pageClazz) {
   Deque<Class<?>> classStack = ReflectionUtils.getClassAncestry(pageClazz);
   while (!classStack.isEmpty()) {
     invokePostConstructMethodsOfClass(pageInstance, classStack.pop());
   }
 }
 private <T extends PageObject> void checkVisibilityOfAnnotatedFields(
     T pageInstance, Class<T> pageClazz) {
   Deque<Class<?>> classStack = ReflectionUtils.getClassAncestry(pageClazz);
   while (!classStack.isEmpty()) {
     checkVisibilityOfAnnotatedFieldsOfClass(pageInstance, classStack.pop());
   }
 }
 private <T extends PageObject> void initializeOtherPageObjectTypeFields(
     T pageInstance, Class<T> pageClazz) {
   Browser browser = pageInstance.getBrowser();
   Deque<Class<?>> classAncestry = ReflectionUtils.getClassAncestry(pageClazz);
   while (!classAncestry.isEmpty()) {
     initializeFieldsOfClass(classAncestry.pop(), pageInstance, browser);
   }
 }