code: static Set<JClass> discoverDirectClasses(Outline outline, Set<ClassOutline> classes) throws IllegalAccessException {
  
          Set<String> directClassNames = new LinkedHashSet<>();
          for(ClassOutline classOutline : classes) {
              // for each field, if it's a bean, then visit it
              List<FieldOutline> fields = findAllDeclaredAndInheritedFields(classOutline);
              for(FieldOutline fieldOutline : fields) {
                  JType rawType = fieldOutline.getRawType();
                  CPropertyInfo propertyInfo = fieldOutline.getPropertyInfo();
                  boolean isCollection = propertyInfo.isCollection();
                  if (isCollection) {
                      JClass collClazz = (JClass) rawType;
                      JClass collType = collClazz.getTypeParameters().get(0);
                      addIfDirectClass(directClassNames, collType);
                  } else {
                      addIfDirectClass(directClassNames, rawType);
                  }
                  parseXmlAnnotations(outline, fieldOutline, directClassNames);
              }
          }
  
          Set<JClass> direct = directClassNames
                  .stream()
                  .map(cn -> outline.getCodeModel().directClass(cn))
                  .collect(Collectors.toCollection(LinkedHashSet::new));
  
          return direct;
  
      }
docs: Finds all external class references
  @param outline root of the generated code
  @param classes set of generated classes
  @return set of external classes
  @throws IllegalAccessException throw if there's an error introspecting the annotations