code: static String packageNameOf(TypeElement type) {
          while (true) {
              Element enclosing = type.getEnclosingElement();
              if (enclosing instanceof PackageElement) {
                  return ((PackageElement) enclosing).getQualifiedName().toString();
              }
              type = (TypeElement) enclosing;
          }
      }
docs: Returns the name of the package that the given type is in. If the type is in the default
  (unnamed) package then the name is the empty string.