diff options
author | David Gageot <david@gageot.net> | 2012-09-24 19:14:20 +0200 |
---|---|---|
committer | David Gageot <david@gageot.net> | 2012-09-24 19:24:13 +0200 |
commit | 082a1b5cf450f5f0837d0d51efe3a4f90c24181b (patch) | |
tree | 6040617bb6152d5b339922e26444ba21cd1796ab /sonar-plugin-api | |
parent | dffab878ddf772d36f56b94ee1a739bc3fc1a984 (diff) | |
download | sonarqube-082a1b5cf450f5f0837d0d51efe3a4f90c24181b.tar.gz sonarqube-082a1b5cf450f5f0837d0d51efe3a4f90c24181b.zip |
SONAR-3529 API: ability to define property sets.
Diffstat (limited to 'sonar-plugin-api')
-rw-r--r-- | sonar-plugin-api/src/main/java/org/sonar/api/config/PropertySetValue.java | 26 | ||||
-rw-r--r-- | sonar-plugin-api/src/main/java/org/sonar/api/config/Settings.java | 22 |
2 files changed, 42 insertions, 6 deletions
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/config/PropertySetValue.java b/sonar-plugin-api/src/main/java/org/sonar/api/config/PropertySetValue.java new file mode 100644 index 00000000000..aadfa06a969 --- /dev/null +++ b/sonar-plugin-api/src/main/java/org/sonar/api/config/PropertySetValue.java @@ -0,0 +1,26 @@ +/* + * Sonar, open source software quality management tool. + * Copyright (C) 2008-2012 SonarSource + * mailto:contact AT sonarsource DOT com + * + * Sonar 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. + * + * Sonar 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 Sonar; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 + */ +package org.sonar.api.config; + +/** + * @since 3.3 + */ +public class PropertySetValue { +} diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/config/Settings.java b/sonar-plugin-api/src/main/java/org/sonar/api/config/Settings.java index 3ec41a5cf6e..d9b55af1109 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/config/Settings.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/config/Settings.java @@ -27,16 +27,12 @@ import com.google.common.collect.Maps; import org.apache.commons.lang.ArrayUtils; import org.apache.commons.lang.StringUtils; import org.sonar.api.BatchComponent; +import org.sonar.api.PropertyType; import org.sonar.api.ServerComponent; import org.sonar.api.utils.DateUtils; import javax.annotation.Nullable; - -import java.util.Collections; -import java.util.Date; -import java.util.List; -import java.util.Map; -import java.util.Properties; +import java.util.*; /** * Project Settings on batch side, Global Settings on server side. This component does not access to database, so @@ -184,6 +180,20 @@ public class Settings implements BatchComponent, ServerComponent { return getStringArrayBySeparator(key, ","); } + public final PropertySetValue getPropertySetValue(String key) { + PropertyDefinition property = getDefinitions().get(key); + if ((null == property) || (property.getType() != PropertyType.PROPERTY_SET)) { + throw new IllegalArgumentException("Property " + key + " is not of type PROPERTY_SET"); + } + + String propertySetValueName = getString(key); + + // read json for given key + // search value for given propertySetValueName + + return null; + } + /** * Value is split by carriage returns. * |