/*******************************************************************************
* Copyright (c) 2007, 2014 compeople AG and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* compeople AG - initial API and implementation
*******************************************************************************/
package org.eclipse.riena.beans.common;
/**
* Simple demo bean
*
* @since 4.0
*/
public class Hobby extends AbstractBean {
public static final String PROPERTY_NAME = "name"; //$NON-NLS-1$
public static final String PROPERTY_DESCRIPTION = "description"; //$NON-NLS-1$
private String name;
private String description;
public Hobby() {
}
public Hobby(final String name, final String description) {
this.name = name;
this.description = description;
}
public String getName() {
return name;
}
public void setName(final String name) {
final String oldName = getName();
this.name = name;
firePropertyChanged(PROPERTY_NAME, oldName, name);
}
public String getDescription() {
return description;
}
public void setDescription(final String description) {
final String oldDescription = getDescription();
this.description = description;
firePropertyChanged(PROPERTY_DESCRIPTION, oldDescription, description);
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((description == null) ? 0 : description.hashCode());
result = prime * result + ((name == null) ? 0 : name.hashCode());
return result;
}
@Override
public boolean equals(final Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
final Hobby other = (Hobby) obj;
if (description == null) {
if (other.description != null) {
return false;
}
} else if (!description.equals(other.description)) {
return false;
}
if (name == null) {
if (other.name != null) {
return false;
}
} else if (!name.equals(other.name)) {
return false;
}
return true;
}
}