--- /dev/null
+/*
+ * Sonar, open source software quality management tool.
+ * Copyright (C) 2009 SonarSource SA
+ * 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.check;
+
+/**
+ * @since 2.3
+ */
+public enum Cardinality {
+ SINGLE, MULTIPLE
+}
@Target(ElementType.TYPE)
public @interface Rule {
- static enum Cardinality {
- SINGLE, MULTIPLE
- }
-
-
/**
* The default key is the class name.
*/
import org.apache.commons.lang.builder.HashCodeBuilder;\r
import org.apache.commons.lang.builder.ToStringBuilder;\r
import org.sonar.api.database.DatabaseProperties;\r
+import org.sonar.check.Cardinality;\r
\r
import javax.persistence.*;\r
import java.util.ArrayList;\r
\r
@Enumerated(EnumType.STRING)\r
@Column(name = "cardinality", updatable = true, nullable = false)\r
- private org.sonar.check.Rule.Cardinality cardinality = org.sonar.check.Rule.Cardinality.SINGLE;\r
+ private Cardinality cardinality = Cardinality.SINGLE;\r
\r
@ManyToOne(fetch = FetchType.EAGER)\r
@JoinColumn(name = "parent_id", updatable = true, nullable = true)\r
return setRepositoryKey(repositoryKey).setKey(key).setConfigKey(key);\r
}\r
\r
- public org.sonar.check.Rule.Cardinality getCardinality() {\r
+ public Cardinality getCardinality() {\r
return cardinality;\r
}\r
\r
- public Rule setCardinality(org.sonar.check.Rule.Cardinality c) {\r
+ public Rule setCardinality(Cardinality c) {\r
this.cardinality = c;\r
return this;\r
}\r
import org.codehaus.staxmate.in.SMInputCursor;
import org.sonar.api.ServerComponent;
import org.sonar.api.utils.SonarException;
+import org.sonar.check.Cardinality;
import javax.xml.stream.XMLInputFactory;
import javax.xml.stream.XMLStreamException;
rule.setRulesCategory(new RulesCategory(category));
} else if (StringUtils.equalsIgnoreCase("cardinality", nodeName)) {
- rule.setCardinality(org.sonar.check.Rule.Cardinality.valueOf(StringUtils.trim(cursor.collectDescendantText(false))));
+ rule.setCardinality(Cardinality.valueOf(StringUtils.trim(cursor.collectDescendantText(false))));
} else if (StringUtils.equalsIgnoreCase("param", nodeName)) {
processParameter(rule, cursor);
import org.hamcrest.core.Is;
import org.junit.Test;
import org.sonar.api.utils.SonarException;
-import org.sonar.check.Rule.Cardinality;
+import org.sonar.check.Cardinality;
import java.io.StringReader;
import java.util.List;