View Javadoc
1   package org.kuali.common.devops.model;
2   
3   import org.kuali.common.core.build.ValidatingBuilder;
4   import org.kuali.common.core.validate.annotation.IdiotProofImmutable;
5   import org.kuali.common.util.ObjectUtils;
6   
7   @IdiotProofImmutable
8   public final class CanonicalNameRecord {
9   
10  	private final String alias;
11  	private final String canonical;
12  
13  	private CanonicalNameRecord(Builder builder) {
14  		this.alias = builder.alias;
15  		this.canonical = builder.canonical;
16  	}
17  
18  	public static Builder builder() {
19  		return new Builder();
20  	}
21  
22  	public static class Builder extends ValidatingBuilder<CanonicalNameRecord> {
23  
24  		private String alias;
25  		private String canonical;
26  
27  		@Override
28  		public CanonicalNameRecord build() {
29  			return validate(new CanonicalNameRecord(this));
30  		}
31  
32  		public Builder alias(String alias) {
33  			this.alias = alias;
34  			return this;
35  		}
36  
37  		public Builder canonical(String canonical) {
38  			this.canonical = canonical;
39  			return this;
40  		}
41  
42  		public String getAlias() {
43  			return alias;
44  		}
45  
46  		public void setAlias(String alias) {
47  			this.alias = alias;
48  		}
49  
50  		public String getCanonical() {
51  			return canonical;
52  		}
53  
54  		public void setCanonical(String canonical) {
55  			this.canonical = canonical;
56  		}
57  
58  	}
59  
60  	public String getAlias() {
61  		return alias;
62  	}
63  
64  	public String getCanonical() {
65  		return canonical;
66  	}
67  
68  	@Override
69  	public int hashCode() {
70  		final int prime = 31;
71  		int result = 1;
72  		result = prime * result + alias.hashCode();
73  		result = prime * result + canonical.hashCode();
74  		return result;
75  	}
76  
77  	@Override
78  	public boolean equals(Object other) {
79  		if (ObjectUtils.notEqual(this, other)) {
80  			return false;
81  		} else {
82  			CanonicalNameRecord cname = (CanonicalNameRecord) other;
83  			return alias.equals(cname.getAlias()) && canonical.equals(cname.getCanonical());
84  		}
85  	}
86  
87  }