application.common.NiceName Maven / Gradle / Ivy
package application.common;
public class NiceName {
private final String key;
private final String displayName;
private final String description;
public NiceName(String key, String displayName) {
this(key, displayName, null);
}
public NiceName(String key, String displayName, String description) {
this.key = key;
this.displayName = displayName;
this.description = description;
}
public String getKey() {
return key;
}
public String getDisplayName() {
return displayName;
}
public String getDescription() {
return description;
}
@Override
public String toString() {
return displayName;
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((description == null) ? 0 : description.hashCode());
result = prime * result + ((displayName == null) ? 0 : displayName.hashCode());
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;
NiceName other = (NiceName) obj;
if (description == null) {
if (other.description != null)
return false;
} else if (!description.equals(other.description))
return false;
if (displayName == null) {
if (other.displayName != null)
return false;
} else if (!displayName.equals(other.displayName))
return false;
if (key == null) {
if (other.key != null)
return false;
} else if (!key.equals(other.key))
return false;
return true;
}
}