001/*
002 * SonarQube
003 * Copyright (C) 2009-2016 SonarSource SA
004 * mailto:contact AT sonarsource DOT com
005 *
006 * This program 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 * This program 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 */
020package org.sonarqube.ws.client.project;
021
022import javax.annotation.CheckForNull;
023import javax.annotation.Nullable;
024
025/**
026 * @since 5.5
027 */
028public class CreateRequest {
029
030  private final String key;
031  private final String name;
032  private final String branch;
033
034  private CreateRequest(Builder builder) {
035    this.key = builder.key;
036    this.name = builder.name;
037    this.branch = builder.branch;
038  }
039
040  public String getKey() {
041    return key;
042  }
043
044  public String getName() {
045    return name;
046  }
047
048  @CheckForNull
049  public String getBranch() {
050    return branch;
051  }
052
053  public static Builder builder() {
054    return new Builder();
055  }
056
057  public static class Builder {
058    private String key;
059    private String name;
060    private String branch;
061
062    private Builder() {
063    }
064
065    public Builder setKey(String key) {
066      this.key = key;
067      return this;
068    }
069
070    public Builder setName(String name) {
071      this.name = name;
072      return this;
073    }
074
075    public Builder setBranch(@Nullable String branch) {
076      this.branch = branch;
077      return this;
078    }
079
080    public CreateRequest build() {
081      return new CreateRequest(this);
082    }
083  }
084}