首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Scaladoc继承注意

Scaladoc继承注意
EN

Stack Overflow用户
提问于 2020-09-26 00:10:49
回答 1查看 81关注 0票数 2

是否可以从父类型继承scaladoc并添加自定义通知?

例如:

代码语言:javascript
复制
trait Parent {
  
  /** Add arbitrary number of key-value pairs to entity. */
  def addFields(fields: (String, String)*): this.type
}

class Child extends Parent {

   /** 
    * {@inheritdoc }
    *
    * @note Previously existing keys would be overwritten 
    */
  def addFields(fields: (String, String)*): this.type = ???
}

我希望得到以下scaladoc输出:

代码语言:javascript
复制
class Child extends Parent {

   /** 
    * Add arbitrary number of key-value pairs to entity.
    *
    * @note Previously existing keys would be overwritten 
    */
  def addFields(fields: (String, String)*): this.type = ???
}
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2020-11-01 19:16:54

实际上,您已经掌握了解决方案。与java不同的是,你不需要用大括号来包装@inheritdoc。因此,以下代码将创建所需的输出:

代码语言:javascript
复制
trait Parent {
  
  /** Add arbitrary number of key-value pairs to entity. */
  def addFields(fields: (String, String)*): this.type
}

class Child extends Parent {

   /** 
    * @inheritdoc
    *
    * @note Previously existing keys would be overwritten 
    */
  override def addFields(fields: (String, String)*): this.type = ???
}

I've attached a screenshot to show the final result.

更多信息可以在Generate API documentation上由sbtSCALADOC FOR LIBRARY AUTHORS阅读。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/64067738

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档