View Javadoc
1   package org.kuali.common.devops.model;
2   
3   import org.kuali.common.util.Assert;
4   import org.kuali.common.util.nullify.NullUtils;
5   
6   import com.google.common.base.Optional;
7   
8   public final class Package {
9   
10  	private final String title;
11  	private final String name;
12  	private final Optional<String> description;
13  
14  	public static class Builder {
15  
16  		// Required
17  		private final String title;
18  		private final String name;
19  
20  		// Optional
21  		private Optional<String> description = Optional.absent();
22  
23  		public Builder(String name) {
24  			this(name, name);
25  		}
26  
27  		public Builder(String title, String name) {
28  			this.title = title;
29  			this.name = name;
30  		}
31  
32  		public Builder description(String description) {
33  			this.description = Optional.fromNullable(NullUtils.trimToNull(description));
34  			return this;
35  		}
36  
37  		public Package build() {
38  			Assert.noBlanks(title, name);
39  			return new Package(this);
40  		}
41  	}
42  
43  	private Package(Builder builder) {
44  		this.title = builder.title;
45  		this.name = builder.name;
46  		this.description = builder.description;
47  	}
48  
49  	public String getTitle() {
50  		return title;
51  	}
52  
53  	public String getName() {
54  		return name;
55  	}
56  
57  	public Optional<String> getDescription() {
58  		return description;
59  	}
60  
61  }