001/*
002 * Sonar, open source software quality management tool.
003 * Copyright (C) 2008-2012 SonarSource
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 */
020package org.sonar.api.task;
021
022/**
023 * Implement this interface to provide a new task.
024 * @since 3.5
025 */
026public class TaskDefinition implements TaskComponent {
027
028  private String name;
029  private String description;
030  private String command;
031  private Class<? extends Task> task;
032
033  private TaskDefinition() {
034
035  }
036
037  public static TaskDefinition create() {
038    return new TaskDefinition();
039  }
040
041  public String getName() {
042    return name;
043  }
044
045  public TaskDefinition setName(String name) {
046    this.name = name;
047    return this;
048  }
049
050  public String getDescription() {
051    return description;
052  }
053
054  public TaskDefinition setDescription(String description) {
055    this.description = description;
056    return this;
057  }
058
059  public String getCommand() {
060    return command;
061  }
062
063  public TaskDefinition setCommand(String command) {
064    this.command = command;
065    return this;
066  }
067
068  public Class<? extends Task> getTask() {
069    return task;
070  }
071
072  public TaskDefinition setTask(Class<? extends Task> task) {
073    this.task = task;
074    return this;
075  }
076
077  @Override
078  public String toString() {
079    return "Definition of task " + task + " with command " + command;
080  }
081
082}