1 /*******************************************************************************
2 * Copyright (c) 2013 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.common.ids;
15 * Superclass for all IDs appearing in Winery. These are:
17 * <li>All IDs of elements directly nested in a Definitions element</li>
18 * <li>Subelements of those</li>
21 * We assume that TOSCAcomponentId is always the root node of nested IDs
24 public abstract class GenericId implements Comparable<GenericId> {
26 private final XMLId xmlId;
29 protected GenericId(XMLId xmlId) {
34 * @return null if (this instanceof TOSCAcomponentId). In that case, the
35 * element is already the root element
37 public abstract GenericId getParent();
40 * @return the XML id of this thing
42 public XMLId getXmlId() {
47 public abstract boolean equals(Object obj);
50 public abstract int hashCode();
53 public String toString() {
54 return this.getClass().toString() + " / " + this.getXmlId().toString();