Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
SONAR-9073 rename attributes of api/components/suggestions
- Loading branch information
1 parent
c48062f
commit 9f10a00
Showing
5 changed files
with
86 additions
and
40 deletions.
There are no files selected for viewing
55 changes: 55 additions & 0 deletions
55
server/sonar-server/src/main/java/org/sonar/server/component/ws/SuggestionCategory.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,55 @@ | |||
/* | |||
* SonarQube | |||
* Copyright (C) 2009-2017 SonarSource SA | |||
* mailto:info AT sonarsource DOT com | |||
* | |||
* This program 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. | |||
* | |||
* This program 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 this program; if not, write to the Free Software Foundation, | |||
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | |||
*/ | |||
|
|||
package org.sonar.server.component.ws; | |||
|
|||
import org.sonar.api.resources.Qualifiers; | |||
|
|||
import static java.util.Arrays.stream; | |||
|
|||
public enum SuggestionCategory { | |||
VIEW("views", Qualifiers.VIEW), | |||
SUBVIEW("sub-views", Qualifiers.SUBVIEW), | |||
PROJECT("projects", Qualifiers.PROJECT), | |||
MODULE("modules", Qualifiers.MODULE), | |||
FILE("files", Qualifiers.FILE), | |||
UNIT_TEST_FILE("unit-test-files", Qualifiers.UNIT_TEST_FILE),; | |||
|
|||
private final String name; | |||
private final String qualifier; | |||
|
|||
SuggestionCategory(String name, String qualifier) { | |||
this.name = name; | |||
this.qualifier = qualifier; | |||
} | |||
|
|||
public String getName() { | |||
return name; | |||
} | |||
|
|||
public String getQualifier() { | |||
return qualifier; | |||
} | |||
|
|||
public static SuggestionCategory getByName(String name) { | |||
return stream(values()).filter(c -> c.getName().equals(name)).findAny() | |||
.orElseThrow(() -> new IllegalStateException(String.format("Cannot find category for name '%s'.", name))); | |||
} | |||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters