How to reach PropertyDefinitions properties

61 Views Asked by At

In the JavaDoc, it's clearly defined how to set a property in SonarQube using org.sonar.api.config.PropertyDefinition in a plugin, however there is nothing on how to get it.

It seems to not work like System.getProperty(key) in Java, so, should I declare a new class that implements Configuration? Is there a way to reach these properties back properly?

1

There are 1 best solutions below

2
On BEST ANSWER

You can get a Configuration object through a Context one or by injecting it through extension point constructor:

public MyExtensionPoint(Configuration config) { this.config = config; }

Use context.config() to get your Configuration object.

Then use configuration.get("key") to get the property.