Scaladoc

Other topics

Simple Scaladoc to method

/**
  * Explain briefly what method does here
  * @param x Explain briefly what should be x and how this affects the method.
  * @param y Explain briefly what should be y and how this affects the method.
  * @return Explain what is returned from execution.
  */
def method(x: Int, y: String): Option[Double] = {
  // Method content
}

Syntax:

  • Goes above methods, fields, classes or packages.
  • Starts with /**
  • Each line has an starting * proceding with the comments
  • Ends with */

Parameters:

ParameterDetails
Class specific_
@constructor detailExplains the main constructor of the class
Method specific_
@return detailDetails about what is returned on the method.
Method, Constructor and/or Class tags_
@param x detailDetails about the value parameter x on a method or constructor.
@tparam x detailDetails about the type parameter x on a method or constructor.
@throws detailWhat exceptions may be thrown.
Usage_
@see detailReferences other sources of information.
@note detailAdds a note for pre or post conditions, or any other notable restrictions or expectations.
@example detailProvides example code or related example documentation.
@usecase detailProvides a simplified method definition for when the full method definition is too complex or noisy.
Other_
@author detailProvides information about the author of the following.
@version detailProvides the version that this portion belongs to.
@deprecated detailMarks the following entity as deprecated.

Contributors

Topic Id: 4518

Example Ids: 15826

This site is not affiliated with any of the contributors.