/* * Copyright (C) 2011 Alexey Matveev <mvaleksej@gmail.com> * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ package org.matveev.pomodoro4nb.data; /** * * @author Alexey Matvey */ public class Property<T> { private final String name; private final Class<T> type; public Property(String name, Class<T> type) { this.name = name; this.type = type; } public String getName() { return name; } public Class<T> getType() { return type; } @Override public boolean equals(Object obj) { if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } final Property<T> other = (Property<T>) obj; if ((this.name == null) ? (other.name != null) : !this.name.equals(other.name)) { return false; } if (this.type != other.type && (this.type == null || !this.type.equals(other.type))) { return false; } return true; } @Override public int hashCode() { int hash = 7; hash = 23 * hash + (this.name != null ? this.name.hashCode() : 0); hash = 23 * hash + (this.type != null ? this.type.hashCode() : 0); return hash; } @Override public String toString() { return getClass().getSimpleName() + "{" + "name=" + name + ", type=" + type + '}'; } }