Java tutorial
/* Copyright (C) 2015, University of Kansas Center for Research * * Specify Software Project, specify@ku.edu, Biodiversity Institute, * 1345 Jayhawk Boulevard, Lawrence, Kansas, 66045, USA * * 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 2 * 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, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ package edu.ku.brc.specify.tools.schemalocale; import org.apache.commons.lang.StringUtils; /** * @author rod * * @code_status Alpha * * Sep 28, 2007 * */ public class LocalizableJListItem implements Comparable<LocalizableJListItem> { protected String name; protected Integer id; protected String displayName; public LocalizableJListItem(final String name, final Integer id, final String displayName) { super(); this.name = name; this.id = id; this.displayName = displayName; } /** * @return the name */ public String getName() { return name; } /** * @return the id */ public Integer getId() { return id; } /** * @return the displayName */ public String getDisplayName() { return displayName; } /* (non-Javadoc) * @see java.lang.Object#toString() */ @Override public String toString() { return StringUtils.isNotEmpty(displayName) ? displayName : name; } /* (non-Javadoc) * @see java.lang.Comparable#compareTo(java.lang.Object) */ public int compareTo(LocalizableJListItem o) { return toString().compareTo(o.toString()); } }