1 /*******************************************************************************
2 * Copyright (c) 2010, 2012 Association for Decentralized Information Management
4 * All rights reserved. This program and the accompanying materials
5 * are made available under the terms of the Eclipse Public License v1.0
6 * which accompanies this distribution, and is available at
7 * http://www.eclipse.org/legal/epl-v10.html
10 * VTT Technical Research Centre of Finland - initial API and implementation
11 *******************************************************************************/
12 package org.simantics.browsing.ui.swt.contentassist;
15 * @author Tuukka Lehtonen
17 public class NamedObject<T> implements INamedObject {
19 private final T object;
20 private final String name;
21 private final String label;
22 private final String description;
24 public NamedObject(T object, String name) {
25 this(object, name, name);
28 public NamedObject(T object, String name, String label) {
29 this(object, name, label, null);
32 public NamedObject(T object, String name, String label, String description) {
36 this.description = description;
40 public String getName() {
44 public String getLabel() {
48 public String getDescription() {
52 public T getObject() {
57 public int hashCode() {
60 result = prime * result + ((object == null) ? 0 : object.hashCode());
65 public boolean equals(Object obj) {
70 if (getClass() != obj.getClass())
72 NamedObject<?> other = (NamedObject<?>) obj;
74 if (other.object != null)
76 } else if (!object.equals(other.object))
82 public String toString() {
83 return getClass().getSimpleName() + "[name=" + name + "]";