You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

Property.java 3.9KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  1. /*
  2. * SonarQube
  3. * Copyright (C) 2009-2019 SonarSource SA
  4. * mailto:info AT sonarsource DOT com
  5. *
  6. * This program is free software; you can redistribute it and/or
  7. * modify it under the terms of the GNU Lesser General Public
  8. * License as published by the Free Software Foundation; either
  9. * version 3 of the License, or (at your option) any later version.
  10. *
  11. * This program is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  14. * Lesser General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU Lesser General Public License
  17. * along with this program; if not, write to the Free Software Foundation,
  18. * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
  19. */
  20. package org.sonar.api;
  21. import java.lang.annotation.ElementType;
  22. import java.lang.annotation.Retention;
  23. import java.lang.annotation.RetentionPolicy;
  24. import java.lang.annotation.Target;
  25. /**
  26. * Property value can be set in different ways :
  27. * <ul>
  28. * <li>System property</li>
  29. * <li>Batch command-line (-Dfoo=bar in Maven or sonar-runner)</li>
  30. * <li>Maven pom.xml (element {@literal <properties>})</li>
  31. * <li>Maven settings.xml</li>
  32. * <li>SonarQube web administration console</li>
  33. * </ul>
  34. *
  35. * @since 1.10
  36. */
  37. @Retention(RetentionPolicy.RUNTIME)
  38. @Target(ElementType.TYPE)
  39. public @interface Property {
  40. /**
  41. * Unique key within all plugins. It's recommended to prefix the key by 'sonar.' and the plugin name. Examples :
  42. * 'sonar.cobertura.reportPath' and 'sonar.cpd.minimumTokens'.
  43. */
  44. String key();
  45. /**
  46. * The empty string "" is considered as null, so it's not possible to have empty strings for default values.
  47. */
  48. String defaultValue() default "";
  49. String name();
  50. String description() default "";
  51. /**
  52. * @since 2.11
  53. * @see org.sonar.api.config.PropertyDefinition#category()
  54. */
  55. String category() default "";
  56. /**
  57. * Is the property displayed in project settings page ?
  58. */
  59. boolean project() default false;
  60. /**
  61. * Is the property displayed in module settings page ? A module is a maven sub-project.
  62. */
  63. boolean module() default false;
  64. /**
  65. * Is the property displayed in global settings page ?
  66. */
  67. boolean global() default true;
  68. /**
  69. * @since 3.0
  70. */
  71. PropertyType type() default PropertyType.STRING;
  72. /**
  73. * Options for *_LIST types
  74. *
  75. * @since 3.0 Options for property of type {@link PropertyType#SINGLE_SELECT_LIST}
  76. * For example {"property_1", "property_3", "property_3"}).
  77. *
  78. * @since 3.3 Options for property of type {@link PropertyType#METRIC}<br>
  79. * If no option is specified, any metric will match.<br>
  80. * If options are specified, all must match for the metric to be displayed.<br>
  81. * Three types of filter are supported <code>key:REGEXP</code>, <code>domain:REGEXP</code> and <code>type:comma_separated__list_of_types</code>.<br>
  82. * For example <code>key:new_.*</code> will match any metric which key starts by <code>new_</code>.<br>
  83. * For example <code>type:INT,FLOAT</code> will match any metric of type <code>INT</code> or <code>FLOAT</code>.<br>
  84. * For example <code>type:NUMERIC</code> will match any metric of numerictype.
  85. */
  86. String[] options() default {};
  87. /**
  88. * Can the property take multiple values. Eg: list of email addresses.
  89. *
  90. * @since 3.3
  91. */
  92. boolean multiValues() default false;
  93. /**
  94. * A Property of type <code>PropertyType.PROPERTY_SET</code> can reference a set of properties
  95. * by its key.
  96. *
  97. * @since 3.3
  98. * @deprecated since 6.1, as it was not used and too complex to maintain.
  99. */
  100. @Deprecated
  101. String propertySetKey() default "";
  102. /**
  103. * A Property with fields is considered a property set.
  104. *
  105. * @since 3.3
  106. */
  107. PropertyField[] fields() default {};
  108. /**
  109. * Relocation of key.
  110. * @since 3.4
  111. */
  112. String deprecatedKey() default "";
  113. }