docs: def compile_type_document(self, imports_block, package, name, declaration):
          """ Compile a complete document, documenting a type and its members """
  
          outer_type = name.rpartition('.')[0]
  
          document = util.Document()
          document.add(imports_block)
          document.add_heading(name, '=')
  
          method_summary = util.StringBuilder()
          document.add_object(method_summary)
  
          package_dir = util.Directive('java:package', package)
          package_dir.add_option('noindex')
          document.add_object(package_dir)
  
          # Add type-level documentation
          type_dir = self.compile_type(declaration)
          if outer_type:
              type_dir.add_option('outertype', outer_type)
          document.add_object(type_dir)
  
          if isinstance(declaration, javalang.tree.EnumDeclaration):
              enum_constants = list(declaration.body.constants)
              enum_constants.sort(key=lambda c: c.name)
  
              document.add_heading('Enum Constants')
              for enum_constant in enum_constants:
                  if self.member_headers:
                      document.add_heading(enum_constant.name, '^')
                  c = self.compile_enum_constant(name, enum_constant)
                  c.add_option('outertype', name)
                  document.add_object(c)
  
          fields = list(filter(self.filter, declaration.fields))
          if fields:
              document.add_heading('Fields', '-')
              fields.sort(key=lambda f: f.declarators[0].name)
              for field in fields:
                  if self.member_headers:
                      document.add_heading(field.declarators[0].name, '^')
                  f = self.compile_field(field)
                  f.add_option('outertype', name)
                  document.add_object(f)
  
          constructors = list(filter(self.filter, declaration.constructors))
          if constructors:
              document.add_heading('Constructors', '-')
              constructors.sort(key=lambda c: c.name)
              for constructor in constructors:
                  if self.member_headers:
                      document.add_heading(constructor.name, '^')
                  c = self.compile_constructor(constructor)
                  c.add_option('outertype', name)
                  document.add_object(c)
  
          methods = list(filter(self.filter, declaration.methods))
          if methods:
              document.add_heading('Methods', '-')
              methods.sort(key=lambda m: m.name)
              for method in methods:
                  if self.member_headers:
                      document.add_heading(method.name, '^')
                  m = self.compile_method(method)
                  m.add_option('outertype', name)
                  document.add_object(m)
  
          return document