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