Skip to content

Object Structure

PiggyPiglet edited this page Feb 6, 2021 · 3 revisions

Object Structure

There's 4 main classes which are a part of the object structure.

  • DocumentedObject
  • TypeMetadata
  • MethodMetadata
  • FieldMetadata

The idea is, that any similarities between the 3 types of metadata, should be in the documented object class, whereas specific things are in the metadata classes. Currently, the DocumentedObject class has the following fields:

  • link: Link to the object on the javadoc.
  • type: What kind of object this is (class, method, etc).
  • package: Package of the object.
  • name: Name of the object (without type parameters).
  • description: Description of the object as it is on the javadoc, including HTML tags.
  • strippedDescription: Description, but with the HTML stripped.
  • annotations: Unordered set of annotations on the object.
  • deprecated: Whether the object is deprecated or not (boolean).
  • deprecationMessage: Comment left by the author on the reasoning of this object's deprecation.
  • modifiers: Ordered set of the object's modifiers.
  • metadata: Either TypeMetadata, MethodMetadata, or FieldMetadata.

None of these fields will ever be null, strings and collections will default to empty, and booleans false. The metadata field itself is of type Object, but it is guaranteed to be one of the 3 specified before. Which metadata it is can be determined via the type field. Mutability/immutability on the collections (in documented object and metadata objects) isn't guaranteed, but ideally they shouldn't ever be modified.

Type Metadata

The type metadata has the following fields, which from their naming should all be obvious:

  • extensions
  • implementations
  • allImplementations
  • superInterfaces
  • subInterfaces
  • subClasses
  • implementingClasses
  • methods
  • fields

These are all unordered sets of strings (fqns).

Detail Metadata

Due to shared similarities between methods & fields, there is a parent interface called DetailMetadata. This isn't exposed in the json api, but is used for grouping internally. Fields:

  • owner: Owner of this detail (fqn)
  • returns: The type that this detail returns

Method Metadata

Fields:

  • parameters: Ordered set of parameter strings
  • parameterDescriptions: Map of parameter names binded to their descriptions. A parameter isn't guaranteed to have an entry in this map.
  • returnsDescription: The description of what is returned by this method.
  • throwing: Unordered entry set of key (throwable) to value (description). An entry set is used over a map as the same throwable may have multiple descriptions.

Field Metadata

Fields don't have any unique metadata from detail metadata