1 /** 2 * Copyright (c) 2013-2017 Polago AB 3 * All rights reserved. 4 * 5 * Permission is hereby granted, free of charge, to any person obtaining 6 * a copy of this software and associated documentation files (the 7 * "Software"), to deal in the Software without restriction, including 8 * without limitation the rights to use, copy, modify, merge, publish, 9 * distribute, sublicense, and/or sell copies of the Software, and to 10 * permit persons to whom the Software is furnished to do so, subject to 11 * the following conditions: 12 * 13 * The above copyright notice and this permission notice shall be 14 * included in all copies or substantial portions of the Software. 15 * 16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 18 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 19 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 20 * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 21 * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 22 * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 */ 24 25 package org.polago.deployconf.task.properties; 26 27 /** 28 * A single Property value in a Properties Task. 29 */ 30 public class Property { 31 private String name; 32 33 private String description; 34 35 private String value; 36 37 private String defaultValue; 38 39 private String group; 40 41 private String condition; 42 43 /** 44 * Public Constructor. 45 * 46 * @param name the property name 47 * @param description the property description 48 * @param defaultValue the property default value 49 * @param value the property value 50 */ 51 public Property(String name, String description, String defaultValue, String value) { 52 this.name = name; 53 this.description = description; 54 this.defaultValue = defaultValue; 55 this.value = value; 56 } 57 58 /** 59 * Gets the name property value. 60 * 61 * @return the current value of the name property 62 */ 63 public String getName() { 64 return name; 65 } 66 67 /** 68 * Sets the name property. 69 * 70 * @param name the new property value 71 */ 72 public void setName(String name) { 73 this.name = name; 74 } 75 76 /** 77 * Gets the description property value. 78 * 79 * @return the current value of the description property 80 */ 81 public String getDescription() { 82 return description; 83 } 84 85 /** 86 * Sets the description property. 87 * 88 * @param description the new property value 89 */ 90 public void setDescription(String description) { 91 this.description = description; 92 } 93 94 /** 95 * Gets the value property value. 96 * 97 * @return the current value of the value property 98 */ 99 public String getValue() { 100 return value; 101 } 102 103 /** 104 * Sets the value property. 105 * 106 * @param value the new property value 107 */ 108 public void setValue(String value) { 109 this.value = value; 110 } 111 112 /** 113 * Gets the defaultValue property value. 114 * 115 * @return the current value of the defaultValue property 116 */ 117 public String getDefaultValue() { 118 return defaultValue; 119 } 120 121 /** 122 * Sets the defaultValue property. 123 * 124 * @param defaultValue the new property value 125 */ 126 public void setDefaultValue(String defaultValue) { 127 this.defaultValue = defaultValue; 128 } 129 130 /** 131 * Gets the group property value. 132 * 133 * @return the current value of the group property 134 */ 135 public String getGroup() { 136 return group; 137 } 138 139 /** 140 * Sets the group property. 141 * 142 * @param group the new property value 143 */ 144 public void setGroup(String group) { 145 this.group = group; 146 } 147 148 /** 149 * Gets the condition property value. 150 * 151 * @return the current value of the condition property 152 */ 153 public String getCondition() { 154 return condition; 155 } 156 157 /** 158 * Sets the condition property. 159 * 160 * @param condition the new property value 161 */ 162 public void setCondition(String condition) { 163 this.condition = condition; 164 } 165 166 /** 167 * {@inheritDoc} 168 */ 169 @Override 170 public int hashCode() { 171 return getName().hashCode(); 172 } 173 174 /** 175 * {@inheritDoc} 176 */ 177 @Override 178 public boolean equals(Object other) { 179 boolean result = false; 180 181 if (other instanceof Property) { 182 Property otherToken = (Property) other; 183 result = getName().equals(otherToken.getName()); 184 } 185 186 return result; 187 } 188 189 /** 190 * {@inheritDoc} 191 */ 192 @Override 193 public String toString() { 194 return "Property [name=" + name + ", description=" + description + ", value=" + value + ", defaultValue=" 195 + defaultValue + ", group=" + group + ", condition=" + condition + "]"; 196 } 197 198 }