【问题标题】:Code snippet inside @param Javadoc@param Javadoc 中的代码片段
【发布时间】:2014-07-14 11:51:12
【问题描述】:

是否可以将代码 sn-p 放在参数的 JavaDoc 中?我尝试了以下方法,但生成的文档中的代码 sn-p 没有这样格式化。

/**
 * Description of method
 *
 * @param dataSourceProperties defines the properties of this datasource. At a minimum, the following should
 * be provided
 *
 * <pre>
 * {@code
 *     String driverClassName = 'com.mysql.jdbc.Driver';
 *     String url = 'jdbc:mysql://localhost/example';
 *     String username = 'root';
 *     String password = 'password';
 * }
 * </pre>
 */

【问题讨论】:

  • 您的代码无法编译,添加一个“;”到行尾
  • 我不确定这里的问题是什么,至少在 Eclipse 工具提示中代码对我来说看起来不错。你在期待什么?

标签: java javadoc


【解决方案1】:

你快到了。试试这个:

/**
 * Description of method
 *
 * @param dataSourceProperties defines the properties of this datasource. At a minimum, the following should
 * be provided
 *
 * <pre>
 * <code>
 *     String driverClassName = 'com.mysql.jdbc.Driver'
 *     String url = 'jdbc:mysql://localhost/example'
 *     String username = 'root'
 *     String password = 'password'
 * </code>
 * </pre>
 */

【讨论】:

    猜你喜欢
    • 2018-09-14
    • 2011-12-23
    • 1970-01-01
    • 2018-12-16
    • 2023-03-24
    • 1970-01-01
    • 2010-09-13
    • 2021-05-21
    • 2019-04-12
    相关资源
    最近更新 更多