1 /*******************************************************************************
2 * Copyright (c) 2014 University of Stuttgart.
3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License v1.0
5 * and the Apache License 2.0 which both accompany this distribution,
6 * and are available at http://www.eclipse.org/legal/epl-v10.html
7 * and http://www.apache.org/licenses/LICENSE-2.0
10 * Oliver Kopp - initial API and implementation
11 *******************************************************************************/
12 package org.eclipse.winery.repository.datatypes.select2;
15 * Models a data item for select2. In case optgroups have to be returned, use
16 * this element in a TreeMap
18 public class Select2DataItem implements Comparable<Select2DataItem> {
20 private final String id;
21 private final String text;
24 public Select2DataItem(String id, String text) {
29 public String getId() {
33 public String getText() {
38 * Sort order is based on text
41 public int compareTo(Select2DataItem o) {
42 return this.getText().compareTo(o.getText());
46 * Equality is checked at id level
49 public boolean equals(Object o) {
50 if (!(o instanceof Select2DataItem)) {
53 return this.getId().equals(((Select2DataItem) o).getId());