Skip to content

03. Document Properties

Li Junyu edited this page May 8, 2023 · 7 revisions

Properties are additional objects attached to a document (Class, Field, Method, etc.). With properties, you can change the name/type of method/field, add comments, or assign new types for type conversion (like Special.Item to Internal.ItemStack_).

Recommended to read with 02. Dynamic Document Modification.

Functional Properties

Functional properties are directly attached to the document and have a specific effect on the original document.

property:modify

Modifies a param in the method, can only be attached to a method document.

{
    "type": "property:modify",
    // The index of param in the method starting from 0.
    "index": 0,
    // The new name of the param, unchanged if omitted.
    "name" : "ingredient"
    // The new type of the param, unchanged if omitted. See the Type Properties section below for type specifications.
    "newType": {
        "type": "type:class",
        "name": "net.minecraft.world.item.crafting.Ingredient"
    }
}

property:assign

Assigns a new type for conversion to the class, It can only be attached to a class document.

property:comment

Attachs lines of comment to the object attached when formatted. It can be applied to all documents.

{
    "type": "property:comment",
    "lines": [
        // Multiple lines of comments will be joined with newlines when formatted.
        "Comment1",
        "Comment2",
    ]
}

property:hide

Hides the attached object. It can be applied to all documents.

{
    "type": "property:hide"
}

Type properties

Type properties describe a type for many usages in the document.

type:primitive

Represents a plain string. Will be as-is when formatted.

type:class

Represents a class type. Will be automatically resolved when formatted.

type:array

Represents an array type. Will be InnerType[] when formatted.

type:parameterized

Represents a parameterized type. WIll be BaseType<ParamType1, ...> when formatted.

type:variable

Represents a variable type. Will be as-is when formatted.

type:union

Represents a union type. Will be Type1 | Type2 ... when formatted.

type:intersection

Represents an intersection type. Will be Type1 & Type2 ... when formatted.

type:jsArray

Reprensents a JSDoc array type. Will be [Type1, Type2 ...] when formatted.

type:object

Represents an object type. Will be {key1: Type1, key2: Type2 ...} when formatted.

Clone this wiki locally