You can take a look at the Kotlin documentation about how to put doc comments in the code.
You can place documentation wherever the thing you want to document is.
/**
* Here goes your main Vegetables type doc.
*
* You can refer to the [id] constructor argument like this.
*/
enum class Vegetables(
/**
* Here goes the doc for your id constructor argument and property.
*/
val id: Int
) {
/**
* Here goes the doc for POTATO.
*/
POTATO(1),
/**
* Here goes the doc for CARROT.
*/
CARROT(2),
/**
* Here goes the doc for CUCUMBER.
*/
CUCUMBER(3)
}
Alternatively, you can also document properties from the class doc:
/**
* Here goes your main Vegetables type doc.
*
* You can refer to the [id] constructor argument like this.
*
* @property id You can also document the id property this way
*/
enum class Vegetables(val id: Int) {
// ...
}
You can take a look at the Kotlin documentation about how to put doc comments in the code.
You can place documentation wherever the thing you want to document is.
Alternatively, you can also document properties from the class doc: