001 /*
002 * Sonar, open source software quality management tool.
003 * Copyright (C) 2009 SonarSource SA
004 * mailto:contact AT sonarsource DOT com
005 *
006 * Sonar is free software; you can redistribute it and/or
007 * modify it under the terms of the GNU Lesser General Public
008 * License as published by the Free Software Foundation; either
009 * version 3 of the License, or (at your option) any later version.
010 *
011 * Sonar is distributed in the hope that it will be useful,
012 * but WITHOUT ANY WARRANTY; without even the implied warranty of
013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
014 * Lesser General Public License for more details.
015 *
016 * You should have received a copy of the GNU Lesser General Public
017 * License along with Sonar; if not, write to the Free Software
018 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02
019 */
020 package org.sonar.api.checks.templates;
021
022 import org.apache.commons.lang.builder.ToStringBuilder;
023
024 import java.util.Locale;
025
026 /**
027 * EXPERIMENTAL - will be used in version 2.2
028 *
029 * Non-internationalized check
030 *
031 * @since 2.1
032 */
033 public class DefaultCheckTemplate extends CheckTemplate {
034
035 private String title;
036 private String description;
037
038 public DefaultCheckTemplate() {
039 }
040
041 public DefaultCheckTemplate(String key) {
042 super(key);
043 }
044
045 public void setTitle(String title) {
046 this.title = title;
047 }
048
049 public void setDescription(String description) {
050 this.description = description;
051 }
052
053 @Override
054 public String getTitle(Locale locale) {
055 if (title == null || "".equals(title)) {
056 return getKey();
057 }
058 return title;
059 }
060
061 @Override
062 public String getDescription(Locale locale) {
063 return description;
064 }
065
066 @Override
067 public String getMessage(Locale locale, String key, Object... params) {
068 return null;
069 }
070
071 @Override
072 public String toString() {
073 return new ToStringBuilder(this)
074 .append("key", key)
075 .append("title", title)
076 .append("configKey", configKey)
077 .append("priority", priority)
078 .append("isoCategory", isoCategory)
079 .toString();
080 }
081 }