diff options
Diffstat (limited to 'sonar-plugin-api')
-rw-r--r-- | sonar-plugin-api/src/main/java/org/sonar/api/profiles/ProfilePrototype.java | 9 | ||||
-rw-r--r-- | sonar-plugin-api/src/main/java/org/sonar/api/utils/ValidationMessages.java | 23 |
2 files changed, 24 insertions, 8 deletions
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/profiles/ProfilePrototype.java b/sonar-plugin-api/src/main/java/org/sonar/api/profiles/ProfilePrototype.java index c4cc93cef93..979981a85b8 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/profiles/ProfilePrototype.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/profiles/ProfilePrototype.java @@ -165,7 +165,14 @@ public final class ProfilePrototype { @Override public String toString() { - return new StringBuilder().append("[repository=").append(repositoryKey).append(",key=").append(key).append("]").toString(); + StringBuilder sb = new StringBuilder().append("[repository=").append(repositoryKey); + if (StringUtils.isNotBlank(key)) { + sb.append(",key=").append(key); + } + if (StringUtils.isNotBlank(configKey)) { + sb.append(",configKey=").append(configKey); + } + return sb.append("]").toString(); } } } diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/utils/ValidationMessages.java b/sonar-plugin-api/src/main/java/org/sonar/api/utils/ValidationMessages.java index bff9074bd12..4813f447fd3 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/utils/ValidationMessages.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/utils/ValidationMessages.java @@ -38,21 +38,22 @@ public final class ValidationMessages { public boolean hasErrors() { return !errors.isEmpty(); } + public List<Message> getErrors() { return errors; } + public ValidationMessages addError(String key, String label) { + errors.add(new Message(key, label)); + return this; + } + public List<Message> getWarnings() { return warnings; } - public List<Message> getInfos() { - return infos; - } - - public ValidationMessages addError(String key, String label) { - errors.add(new Message(key, label)); - return this; + public boolean hasWarnings() { + return !warnings.isEmpty(); } public ValidationMessages addWarning(String key, String label) { @@ -60,6 +61,14 @@ public final class ValidationMessages { return this; } + public List<Message> getInfos() { + return infos; + } + + public boolean hasInfos() { + return !infos.isEmpty(); + } + public ValidationMessages addInfo(String key, String label) { infos.add(new Message(key, label)); return this; |