001 /* 002 * SonarQube, open source software quality management tool. 003 * Copyright (C) 2008-2014 SonarSource 004 * mailto:contact AT sonarsource DOT com 005 * 006 * SonarQube 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 * SonarQube 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 License 017 * along with this program; if not, write to the Free Software Foundation, 018 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 019 */ 020 package org.sonar.api.batch.analyzer.internal; 021 022 import org.sonar.api.batch.analyzer.AnalyzerDescriptor; 023 import org.sonar.api.batch.fs.InputFile; 024 import org.sonar.api.batch.measure.Metric; 025 026 import java.util.Arrays; 027 import java.util.Collection; 028 029 public class DefaultAnalyzerDescriptor implements AnalyzerDescriptor { 030 031 private String name; 032 private Metric<?>[] dependsOn = new Metric<?>[0]; 033 private Metric<?>[] provides = new Metric<?>[0]; 034 private String[] languages = new String[0]; 035 private InputFile.Type[] types = new InputFile.Type[0]; 036 private String[] ruleRepositories = new String[0]; 037 038 public String name() { 039 return name; 040 } 041 042 public Metric[] dependsOn() { 043 return dependsOn; 044 } 045 046 public Metric[] provides() { 047 return provides; 048 } 049 050 public Collection<String> languages() { 051 return Arrays.asList(languages); 052 } 053 054 public Collection<InputFile.Type> types() { 055 return Arrays.asList(types); 056 } 057 058 public Collection<String> ruleRepositories() { 059 return Arrays.asList(ruleRepositories); 060 } 061 062 @Override 063 public DefaultAnalyzerDescriptor name(String name) { 064 this.name = name; 065 return this; 066 } 067 068 @Override 069 public DefaultAnalyzerDescriptor dependsOn(Metric<?>... metrics) { 070 this.dependsOn = metrics; 071 return this; 072 } 073 074 @Override 075 public DefaultAnalyzerDescriptor provides(Metric<?>... metrics) { 076 this.provides = metrics; 077 return this; 078 } 079 080 @Override 081 public DefaultAnalyzerDescriptor workOnLanguages(String... languageKeys) { 082 this.languages = languageKeys; 083 return this; 084 } 085 086 @Override 087 public DefaultAnalyzerDescriptor workOnFileTypes(InputFile.Type... types) { 088 this.types = types; 089 return this; 090 } 091 092 @Override 093 public DefaultAnalyzerDescriptor createIssuesForRuleRepositories(String... repositoryKeys) { 094 this.ruleRepositories = repositoryKeys; 095 return this; 096 } 097 098 }