<legend id='D35jV'><style id='D35jV'><dir id='D35jV'><q id='D35jV'></q></dir></style></legend>
  • <i id='D35jV'><tr id='D35jV'><dt id='D35jV'><q id='D35jV'><span id='D35jV'><b id='D35jV'><form id='D35jV'><ins id='D35jV'></ins><ul id='D35jV'></ul><sub id='D35jV'></sub></form><legend id='D35jV'></legend><bdo id='D35jV'><pre id='D35jV'><center id='D35jV'></center></pre></bdo></b><th id='D35jV'></th></span></q></dt></tr></i><div id='D35jV'><tfoot id='D35jV'></tfoot><dl id='D35jV'><fieldset id='D35jV'></fieldset></dl></div>
      <tfoot id='D35jV'></tfoot>

        <small id='D35jV'></small><noframes id='D35jV'>

          <bdo id='D35jV'></bdo><ul id='D35jV'></ul>

        如何在Java中创建单个注释接受多个值

        how to create a single annotation accept multiple values in Java(如何在Java中创建单个注释接受多个值)
            • <bdo id='D8Mo3'></bdo><ul id='D8Mo3'></ul>
              <i id='D8Mo3'><tr id='D8Mo3'><dt id='D8Mo3'><q id='D8Mo3'><span id='D8Mo3'><b id='D8Mo3'><form id='D8Mo3'><ins id='D8Mo3'></ins><ul id='D8Mo3'></ul><sub id='D8Mo3'></sub></form><legend id='D8Mo3'></legend><bdo id='D8Mo3'><pre id='D8Mo3'><center id='D8Mo3'></center></pre></bdo></b><th id='D8Mo3'></th></span></q></dt></tr></i><div id='D8Mo3'><tfoot id='D8Mo3'></tfoot><dl id='D8Mo3'><fieldset id='D8Mo3'></fieldset></dl></div>

              <legend id='D8Mo3'><style id='D8Mo3'><dir id='D8Mo3'><q id='D8Mo3'></q></dir></style></legend>
            • <small id='D8Mo3'></small><noframes id='D8Mo3'>

                  <tbody id='D8Mo3'></tbody>

                1. <tfoot id='D8Mo3'></tfoot>
                  本文介绍了如何在Java中创建单个注释接受多个值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我有一个名为

                  @Retention( RetentionPolicy.SOURCE )
                  @Target( ElementType.METHOD )
                  public @interface JIRA
                  {
                      /**
                       * The 'Key' (Bug number / JIRA reference) attribute of the JIRA issue.
                       */
                      String key();
                  }
                  

                  允许像这样添加注释

                  @JIRA( key = "JIRA1" )
                  

                  有没有办法让这种情况发生

                  is there any way to allow this to happen

                  @JIRA( key = "JIRA1", "JIRA2", .....  )
                  

                  原因是,我们目前对测试进行了注释针对 Jira 任务或错误修复,但有时,然后该值将被声纳解析.问题是单个测试涵盖了超过 1 个错误.

                  the reason is, we currently annotate the test against a Jira task or bug fix, but sometimes, then the value will get parsed by sonar. problem is a single test covers more then 1 bug.

                  推荐答案

                  更改您的 key() 函数以返回 String[] 而不是 String 然后您可以使用 String[]

                  Change your key() function to return String[] rather than String then you can pass various values using String[]

                  public @interface JIRA {
                  /**
                   * The 'Key' (Bug number / JIRA reference) attribute of the JIRA issue.
                   */
                  String[] key();
                  }
                  

                  像下面这样使用它

                  @JIRA(key = {"JIRA1", "JIRA2"})
                  

                  这篇关于如何在Java中创建单个注释接受多个值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  Slf4j LoggerFactory.getLogger and sonarqube(Slf4j LoggerFactory.getLogger 和 sonarqube)
                  Security - Array is stored directly(安全性 - 数组直接存储)
                  SonarQube quot;Class Not Foundquot; during Main AST Scan(SonarQube“找不到类在主 AST 扫描期间)
                  Integrate Spock#39;s test with Sonar(将 Spock 的测试与声纳集成)
                  How do I make Hudson/Jenkins fail if Sonar thresholds are breached?(如果违反声纳阈值,我如何让 Hudson/Jenkins 失败?)
                  automatically add curly brackets to all if/else/for/while etc. in a java code-base(自动将大括号添加到 java 代码库中的所有 if/else/for/while 等)

                    <tbody id='Tx15p'></tbody>

                  1. <small id='Tx15p'></small><noframes id='Tx15p'>

                    • <bdo id='Tx15p'></bdo><ul id='Tx15p'></ul>
                        • <i id='Tx15p'><tr id='Tx15p'><dt id='Tx15p'><q id='Tx15p'><span id='Tx15p'><b id='Tx15p'><form id='Tx15p'><ins id='Tx15p'></ins><ul id='Tx15p'></ul><sub id='Tx15p'></sub></form><legend id='Tx15p'></legend><bdo id='Tx15p'><pre id='Tx15p'><center id='Tx15p'></center></pre></bdo></b><th id='Tx15p'></th></span></q></dt></tr></i><div id='Tx15p'><tfoot id='Tx15p'></tfoot><dl id='Tx15p'><fieldset id='Tx15p'></fieldset></dl></div>
                            <legend id='Tx15p'><style id='Tx15p'><dir id='Tx15p'><q id='Tx15p'></q></dir></style></legend>
                          • <tfoot id='Tx15p'></tfoot>