View Javadoc
1   /*
2    * Licensed to the Apache Software Foundation (ASF) under one
3    * or more contributor license agreements.  See the NOTICE file
4    * distributed with this work for additional information
5    * regarding copyright ownership.  The ASF licenses this file
6    *  to you under the Apache License, Version 2.0 (the
7    * "License"); you may not use this file except in compliance
8    *  with the License.  You may obtain a copy of the License at
9    *
10   *   http://www.apache.org/licenses/LICENSE-2.0
11   *
12   * Unless required by applicable law or agreed to in writing,
13   * software distributed under the License is distributed on an
14   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15   * KIND, either express or implied.  See the License for the
16   * specific language governing permissions and limitations
17   * under the License.
18   */
19  package org.apache.rat.api.domain;
20  
21  /**
22   * Builds {@link LicenseFamily} instances.
23   */
24  public final class LicenseFamilyBuilder {
25  
26      /**
27       * Begins to build a license family.
28       * 
29       * @return a builder for a license family, not null
30       */
31      public static LicenseFamilyBuilder aLicenseFamily() {
32          return new LicenseFamilyBuilder();
33      }
34  
35      /** Further information associated with the license family. Human readable. */
36      private String notes;
37      /**
38       * Names of the category containing this license family. Recommended that
39       * this be an URI.
40       */
41      private String category;
42      /** Uniquely identifies this family. Choosing a suitable URI is recommended */
43      private String name;
44  
45      /** Use {@link #aLicenseFamily()  */
46      private LicenseFamilyBuilder() {
47      }
48  
49      /**
50       * Builds a family.
51       * 
52       * @return not null
53       */
54      public LicenseFamily build() {
55          return new LicenseFamily(this.name, this.category, this.notes);
56      }
57  
58      /**
59       * Builds family with further information associated with the license
60       * family. Human readable.
61       * 
62       * @param notes
63       *            possibly null
64       * @return this instance, not null
65       */
66      public LicenseFamilyBuilder withNotes(final String notes) {
67          this.notes = notes;
68          return this;
69      }
70  
71      /**
72       * Builds family with category containing this license family. Choosing a
73       * suitable URI is recommended
74       * 
75       * @param category
76       *            possible null
77       * @return this instance, not null
78       */
79      public LicenseFamilyBuilder withCategory(final String category) {
80          this.category = category;
81          return this;
82      }
83  
84      /**
85       * 
86       * Uniquely identifies this family. Choosing a suitable URI is recommended.
87       * 
88       * @param name
89       *            not null
90       * @return this instance, not null
91       */
92      public LicenseFamilyBuilder withName(final String name) {
93          this.name = name;
94          return this;
95      }
96  }