Stuart McCulloch | 26e7a5a | 2011-10-17 10:31:43 +0000 | [diff] [blame] | 1 | package aQute.lib.deployer.obr; |
| 2 | |
| 3 | /** |
| 4 | * @immutable |
| 5 | * @author Neil Bartlett |
| 6 | */ |
| 7 | public class Property { |
| 8 | |
| 9 | static final String PACKAGE = "package"; |
| 10 | static final String USES = "uses"; |
| 11 | static final String VERSION = "version"; |
| 12 | |
| 13 | private final String name; |
| 14 | private final String type; |
| 15 | private final String value; |
| 16 | |
| 17 | public Property(String name, String type, String value) { |
| 18 | this.name = name; |
| 19 | this.type = type; |
| 20 | this.value = value; |
| 21 | } |
| 22 | |
| 23 | public String getName() { |
| 24 | return name; |
| 25 | } |
| 26 | |
| 27 | public String getType() { |
| 28 | return type; |
| 29 | } |
| 30 | |
| 31 | public String getValue() { |
| 32 | return value; |
| 33 | } |
| 34 | |
| 35 | @Override |
| 36 | public String toString() { |
| 37 | StringBuilder builder = new StringBuilder(); |
| 38 | builder.append("Property [name=").append(name).append(", type=").append(type).append(", value=").append(value).append("]"); |
| 39 | return builder.toString(); |
| 40 | } |
| 41 | |
| 42 | @Override |
| 43 | public int hashCode() { |
| 44 | final int prime = 31; |
| 45 | int result = 1; |
| 46 | result = prime * result + ((name == null) ? 0 : name.hashCode()); |
| 47 | result = prime * result + ((type == null) ? 0 : type.hashCode()); |
| 48 | result = prime * result + ((value == null) ? 0 : value.hashCode()); |
| 49 | return result; |
| 50 | } |
| 51 | |
| 52 | @Override |
| 53 | public boolean equals(Object obj) { |
| 54 | if (this == obj) |
| 55 | return true; |
| 56 | if (obj == null) |
| 57 | return false; |
| 58 | if (getClass() != obj.getClass()) |
| 59 | return false; |
| 60 | Property other = (Property) obj; |
| 61 | if (name == null) { |
| 62 | if (other.name != null) |
| 63 | return false; |
| 64 | } else if (!name.equals(other.name)) |
| 65 | return false; |
| 66 | if (type == null) { |
| 67 | if (other.type != null) |
| 68 | return false; |
| 69 | } else if (!type.equals(other.type)) |
| 70 | return false; |
| 71 | if (value == null) { |
| 72 | if (other.value != null) |
| 73 | return false; |
| 74 | } else if (!value.equals(other.value)) |
| 75 | return false; |
| 76 | return true; |
| 77 | } |
| 78 | |
| 79 | } |