|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.sonar.api.config.PropertyDefinition
public final class PropertyDefinition
Declare a plugin property. Values are available at runtime through the component Settings
.
Property
. It is more
testable and adds new features like sub-categories and ordering.
Example:
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() ); } }Keys in localization bundles are:
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 description
Nested Class Summary | |
---|---|
static class |
PropertyDefinition.Builder
|
static class |
PropertyDefinition.Result
|
Method Summary | |
---|---|
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()
|
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)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Method Detail |
---|
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 String name()
public PropertyType type()
public List<String> options()
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()
public String propertySetKey()
public List<PropertyFieldDefinition> fields()
public String deprecatedKey()
public int index()
public String toString()
toString
in class Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |