<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中创建单个注释接受多个值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

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

                  相关文档推荐

                  How to send data to COM PORT using JAVA?(如何使用 JAVA 向 COM PORT 发送数据?)
                  How to make a report page direction to change to quot;rtlquot;?(如何使报表页面方向更改为“rtl?)
                  Use cyrillic .properties file in eclipse project(在 Eclipse 项目中使用西里尔文 .properties 文件)
                  Is there any way to detect an RTL language in Java?(有没有办法在 Java 中检测 RTL 语言?)
                  How to load resource bundle messages from DB in Java?(如何在 Java 中从 DB 加载资源包消息?)
                  How do I change the default locale settings in Java to make them consistent?(如何更改 Java 中的默认语言环境设置以使其保持一致?)

                    <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>