diff options
Diffstat (limited to 'id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/db/dao/config/AbstractConfigProperty.java')
-rw-r--r-- | id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/db/dao/config/AbstractConfigProperty.java | 94 |
1 files changed, 94 insertions, 0 deletions
diff --git a/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/db/dao/config/AbstractConfigProperty.java b/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/db/dao/config/AbstractConfigProperty.java new file mode 100644 index 000000000..d50aa9c6e --- /dev/null +++ b/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/db/dao/config/AbstractConfigProperty.java @@ -0,0 +1,94 @@ +package at.gv.egovernment.moa.id.commons.db.dao.config; + +import java.io.Serializable; + +import javax.persistence.Column; +import javax.persistence.Id; +import javax.persistence.MappedSuperclass; + +@MappedSuperclass +public abstract class AbstractConfigProperty implements Serializable{ + /** + * + */ + private static final long serialVersionUID = 1L; + @Id + @Column(name = "propertyKey", unique = true) + protected String key; + + public AbstractConfigProperty() { + super(); + } + + + /** + * Returns the property's value (which might be {@code null}). + * @return The property's value (might be {@code null}). + */ + abstract public String getValue(); + + /** + * Sets the property's value. + * @param value The value + */ + abstract public void setValue(String value); + + /** + * Returns the property's key. + * @return The key. + */ + public String getKey() { + return key; + } + + /** + * Sets the property's key. + * @param key The key + */ + public void setKey(String key) { + this.key = key; + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((key == null) ? 0 : key.hashCode()); + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (getClass() != obj.getClass()) + return false; + ConfigProperty other = (ConfigProperty) obj; + if (key == null) { + if (other.key != null) + return false; + } else if (!key.equals(other.key)) + return false; + return true; + } + + public String toString() { + StringBuilder builder = new StringBuilder(); + builder.append(getImpplementationName()); + builder.append(" [key="); + builder.append(getKey()); + builder.append(", value="); + builder.append(getValue()); + builder.append("]"); + return builder.toString(); + } + + /** + * Get a name for this Entity-Implementation for logging purposes + * + * @return + */ + abstract protected String getImpplementationName(); +}
\ No newline at end of file |