code: private static Collection<Field> getAllFields(Class<?> refClass) {
          Collection<Field> fields = new ArrayList<>();
          for (Class<?> klazz = refClass; klazz != null; klazz = klazz.getSuperclass()) {
              for (Field field : klazz.getDeclaredFields()) {
                  if (!Modifier.isStatic(field.getModifiers()) &&
                      !field.getType().isPrimitive()) {
                      try {
                          field.setAccessible(true);
                      } catch (SecurityException e) {
                          LOG.error("Security settings prevent Ehcache from accessing the subgraph beneath '{}'" +
                                    " - cache sizes may be underestimated as a result", field, e);
                          continue;
                      }
                      fields.add(field);
                  }
              }
          }
          return fields;
      }
docs: Returns all non-primitive fields for the entire class hierarchy of a type
  
  @param refClass the type
  @return all fields for that type