@ScannerSide @ServerSide @ComputeEngineSide @SonarLintSide @ExtensionPoint public final class PropertyDefinition extends java.lang.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(java.lang.String key) |
java.lang.String |
category()
Category where the property appears in settings pages.
|
java.lang.String |
defaultValue() |
java.lang.String |
deprecatedKey() |
java.lang.String |
description() |
java.util.List<PropertyFieldDefinition> |
fields() |
boolean |
global()
Is the property displayed in global settings page ?
|
int |
index()
Order to display properties in Sonar UI.
|
java.lang.String |
key()
Unique key within all plugins.
|
boolean |
multiValues() |
java.lang.String |
name() |
java.util.List<java.lang.String> |
options()
Options for *_LIST types
Options for property of type PropertyType.SINGLE_SELECT_LIST .For example {"property_1", "property_3", "property_3"}). |
java.lang.String |
propertySetKey()
Deprecated.
since 6.1, as it was not used and too complex to maintain.
|
java.util.List<java.lang.String> |
qualifiers()
Qualifiers that can display this property
|
java.lang.String |
subCategory()
Sub-category where property appears in settings pages.
|
java.lang.String |
toString() |
PropertyType |
type() |
static PropertyDefinition.Result |
validate(PropertyType type,
java.lang.String value,
java.util.List<java.lang.String> options) |
PropertyDefinition.Result |
validate(java.lang.String value) |
public static PropertyDefinition.Builder builder(java.lang.String key)
public static PropertyDefinition.Result validate(PropertyType type, @Nullable java.lang.String value, java.util.List<java.lang.String> options)
public PropertyDefinition.Result validate(@Nullable java.lang.String value)
public java.lang.String key()
public java.lang.String defaultValue()
public java.lang.String name()
public PropertyType type()
public java.util.List<java.lang.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 java.lang.String description()
public java.lang.String category()
public java.lang.String subCategory()
public java.util.List<java.lang.String> qualifiers()
public boolean global()
public boolean multiValues()
@Deprecated public java.lang.String propertySetKey()
public java.util.List<PropertyFieldDefinition> fields()
public java.lang.String deprecatedKey()
public int index()
public java.lang.String toString()
toString
in class java.lang.Object