https://kotlinlang.org logo
Title
w

Wesley Acheson

09/05/2020, 12:44 PM
Whats the correct way to document an enum class?
/**
     * Represents the way two [clauses][Clause] are joined.
     *
     * @property AND Means that this clause and the previous clause should be combined using and
     * (i.e. both need to be `true`)
     * @property OR Means that this clause should be combind with the previous clause using or
     * (i.e. this clause needs to be true or the previous clause needs to be `true`)
     */
    enum class Conjunction() {
        AND,
        OR
    }
Or should the values be on the enums themselves?
n

nanodeath

09/05/2020, 2:01 PM
I think it should be on the values themselves. You can always try both and see how the quick documentation is pulled up when you use it.
w

Wesley Acheson

09/05/2020, 2:01 PM
Yeah I went on the values themselves.
its a little annoying as that could have been written compactly.
n

nanodeath

09/05/2020, 2:03 PM
well, you can always make one-liner
/** short line of doc */
comments
w

Wesley Acheson

09/05/2020, 2:04 PM
yeah in that specific case it could be written as
enum class conjunction{AND,OR}
Thank you though.