Merge "Fix build errors in autorelease full clean build"
[vfc/nfvo/wfengine.git] / winery / org.eclipse.winery.common / src / main / java / org / eclipse / winery / common / ids / GenericId.java
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
8  *
9  * Contributors:
10  *     Oliver Kopp - initial API and implementation
11  *******************************************************************************/
12 package org.eclipse.winery.common.ids;
13
14 /**
15  * Superclass for all IDs appearing in Winery. These are:
16  * <ul>
17  * <li>All IDs of elements directly nested in a Definitions element</li>
18  * <li>Subelements of those</li>
19  * </ul>
20  * 
21  * We assume that TOSCAcomponentId is always the root node of nested IDs
22  * 
23  */
24 public abstract class GenericId implements Comparable<GenericId> {
25         
26         private final XMLId xmlId;
27         
28         
29         protected GenericId(XMLId xmlId) {
30                 this.xmlId = xmlId;
31         }
32         
33         /**
34          * @return null if (this instanceof TOSCAcomponentId). In that case, the
35          *         element is already the root element
36          */
37         public abstract GenericId getParent();
38         
39         /**
40          * @return the XML id of this thing
41          */
42         public XMLId getXmlId() {
43                 return this.xmlId;
44         }
45         
46         @Override
47         public abstract boolean equals(Object obj);
48         
49         @Override
50         public abstract int hashCode();
51         
52         @Override
53         public String toString() {
54                 return this.getClass().toString() + " / " + this.getXmlId().toString();
55         }
56 }