@ScannerSide @ServerSide @ComputeEngineSide @SonarLintSide @ExtensionPoint public final class PropertyDefinition extends Object
Configuration
.
Property
. It is more
testable and adds new features like sub-categories and ordering.
public class MyPlugin extends SonarPlugin {
public List getExtensions() {
return Arrays.asList(
PropertyDefinition.builder("sonar.foo").name("Foo").build(),
PropertyDefinition.builder("sonar.bar").name("Bar").defaultValue("123").type(PropertyType.INTEGER).build()
);
}
}
property.<key>.name
is the label of the propertyproperty.<key>.description
is the optional description of the propertyproperty.category.<category>
is the category labelproperty.category.<category>.description
is the category descriptionproperty.category.<category>.<subcategory>
is the sub-category labelproperty.category.<category>.<subcategory>.description
is the sub-category descriptionModifier and Type | Class and Description |
---|---|
static class |
PropertyDefinition.Builder |
static class |
PropertyDefinition.Result |
Modifier and Type | Method and Description |
---|---|
static PropertyDefinition.Builder |
builder(String key) |
String |
category()
Category where the property appears in settings pages.
|
String |
defaultValue() |
String |
deprecatedKey() |
String |
description() |
List<PropertyFieldDefinition> |
fields() |
boolean |
global()
Is the property displayed in global settings page ?
|
int |
index()
Order to display properties in Sonar UI.
|
String |
key()
Unique key within all plugins.
|
boolean |
multiValues() |
String |
name() |
List<String> |
options()
Options for *_LIST types
Options for property of type PropertyType.SINGLE_SELECT_LIST .For example {"property_1", "property_3", "property_3"}). |
String |
propertySetKey()
Deprecated.
since 6.1, as it was not used and too complex to maintain.
|
List<String> |
qualifiers()
Qualifiers that can display this property
|
String |
subCategory()
Sub-category where property appears in settings pages.
|
String |
toString() |
PropertyType |
type() |
static PropertyDefinition.Result |
validate(PropertyType type,
String value,
List<String> options) |
PropertyDefinition.Result |
validate(String value) |
public static PropertyDefinition.Builder builder(String key)
public static PropertyDefinition.Result validate(PropertyType type, @Nullable String value, List<String> options)
public PropertyDefinition.Result validate(@Nullable String value)
public String key()
public String defaultValue()
public PropertyType type()
public List<String> options()
PropertyType.SINGLE_SELECT_LIST
.PropertyType.METRIC
.key:REGEXP
, domain:REGEXP
and type:comma_separated__list_of_types
.
For example key:new_.*
will match any metric which key starts by new_
.
For example type:INT,FLOAT
will match any metric of type INT
or FLOAT
.
For example type:NUMERIC
will match any metric of numerictype.public String description()
public String category()
public String subCategory()
public List<String> qualifiers()
public boolean global()
public boolean multiValues()
@Deprecated public String propertySetKey()
public List<PropertyFieldDefinition> fields()
public String deprecatedKey()
public int index()
Copyright © 2009–2018 SonarSource. All rights reserved.