SCViewer/com.minres.scviewer.database/src/com/minres/scviewer/database/RelationType.java

60 lines
1.4 KiB
Java
Raw Normal View History

2012-06-17 20:34:50 +02:00
/*******************************************************************************
2015-10-22 00:25:12 +02:00
* Copyright (c) 2015 MINRES Technologies GmbH and others.
2012-06-17 20:34:50 +02:00
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* MINRES Technologies GmbH - initial API and implementation
2012-06-17 20:34:50 +02:00
*******************************************************************************/
package com.minres.scviewer.database;
2012-06-17 19:53:05 +02:00
2018-08-27 23:10:52 +02:00
import java.io.Serializable;
import java.util.HashMap;
2018-08-27 23:10:52 +02:00
public class RelationType implements Serializable {
2015-01-01 23:17:32 +01:00
2018-08-27 23:10:52 +02:00
/**
*
*/
private static final long serialVersionUID = -5598253591502850283L;
private static HashMap<String, RelationType> registry = new HashMap<>();
2015-01-01 23:17:32 +01:00
private String name;
public static RelationType create(String name){
if(registry.containsKey(name)){
return registry.get(name);
}else{
RelationType relType = new RelationType(name);
registry.put(name, relType);
return relType;
}
}
private RelationType(String name) {
2015-01-01 23:17:32 +01:00
super();
this.name = name;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String toString(){
return name;
}
@Override
public int hashCode() {
return name.hashCode();
}
2012-06-17 19:53:05 +02:00
}