【问题标题】:Scaladoc inherit with noticeScaladoc 继承通知
【发布时间】:2021-01-12 00:04:32
【问题描述】:

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

例如:

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 输出:

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 = ???
}

【问题讨论】:

    标签: scala javadoc scaladoc


    【解决方案1】:

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

    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 documentationsbtSCALADOC FOR LIBRARY AUTHORS阅读。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2014-07-09
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-01-07
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多