View Javadoc

1   /*
2    * Copyright (C) 2011 Atlassian
3    *
4    * Licensed under the Apache License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    *     http://www.apache.org/licenses/LICENSE-2.0
9    *
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16  
17  package com.atlassian.jira.rest.client.api.domain.input;
18  
19  import com.atlassian.jira.rest.client.api.domain.Version;
20  import org.joda.time.DateTime;
21  
22  public class VersionInputBuilder {
23      private final String projectKey;
24      private String name;
25      private String description;
26      private DateTime releaseDate;
27      private boolean archived;
28      private boolean released;
29  
30      public VersionInputBuilder(String projectKey) {
31          this.projectKey = projectKey;
32      }
33  
34      public VersionInputBuilder(String projectKey, Version version) {
35          this(projectKey);
36          this.name = version.getName();
37          this.description = version.getDescription();
38          this.archived = version.isArchived();
39          this.released = version.isReleased();
40          this.releaseDate = version.getReleaseDate();
41      }
42  
43  
44      public VersionInputBuilder setName(String name) {
45          this.name = name;
46          return this;
47      }
48  
49      public VersionInputBuilder setDescription(String description) {
50          this.description = description;
51          return this;
52      }
53  
54      public VersionInputBuilder setReleaseDate(DateTime releaseDate) {
55          this.releaseDate = releaseDate;
56          return this;
57      }
58  
59      public VersionInputBuilder setArchived(boolean archived) {
60          this.archived = archived;
61          return this;
62      }
63  
64      public VersionInputBuilder setReleased(boolean released) {
65          this.released = released;
66          return this;
67      }
68  
69      public VersionInput build() {
70          return new VersionInput(projectKey, name, description, releaseDate, archived, released);
71      }
72  }