1 package com.atlassian.plugins.codegen;
2
3 import static com.google.common.base.Preconditions.checkNotNull;
4
5
6
7
8 public abstract class AbstractPropertyValue
9 {
10 private final String name;
11 private final String value;
12
13 protected AbstractPropertyValue(String name, String value)
14 {
15 this.name = checkNotNull(name, "name");
16 this.value = checkNotNull(value, "value");
17 }
18
19 public String getName()
20 {
21 return name;
22 }
23
24 public String getValue()
25 {
26 return value;
27 }
28
29 @Override
30 public String toString()
31 {
32 return name + "=" + value;
33 }
34
35 @Override
36 public boolean equals(Object other)
37 {
38 if (other.getClass() == this.getClass())
39 {
40 AbstractPropertyValue p = (AbstractPropertyValue) other;
41 return name.equals(p.name) && value.equals(p.value);
42 }
43 return false;
44 }
45
46 @Override
47 public int hashCode()
48 {
49 return toString().hashCode();
50 }
51 }