2 * Created on 12-Sep-2005
4 * TODO To change the template for this generated file go to
5 * Window - Preferences - Java - Code Style - Code Templates
7 package uk.ac.vamsas.client;
9 import java.io.Serializable;
12 * The unique reference id for a Vamsas document Vobject,
13 * used by applications to refer to the vamsas Vobject
14 * within their own data space in the vamsas document.
15 * This is serializable (thanks to Dominik Lindner) so an
16 * application can store it easily.
19 public class VorbaId implements Serializable {
21 * 1 is first vamsas release ID version.
23 private static final long serialVersionUID = 1L;
28 private VorbaId(String Id) {
34 * @param vorbaObject the source of vorba Ids
35 * @param vobject the Vobject to be registered with a new vorba id
38 protected static VorbaId newId(IVorbaIdFactory vorbaObject, Vobject vobject) {
39 // Make unique id from appSpace info in vorbaObject
40 synchronized (vorbaObject) {
41 vobject.vorbaId=vorbaObject.makeVorbaId(vobject);
42 return vobject.vorbaId;
46 * protected VorbaId constructor used when turning XML ID strings into vorba IDs
48 * @return VorbaId object or null if string was null.
50 protected static VorbaId newId(String id) {
51 return (id==null) ? null : new VorbaId(id);
54 * @return Returns the id.
56 public String getId() {
60 * @see java.lang.Object#equals(java.lang.Object)
62 public boolean equals(Object obj) {
63 if (obj instanceof String)
64 return id.equals(obj);
65 else if (obj instanceof VorbaId)
66 return id.equals(((VorbaId)obj).id);
70 * @see java.lang.Object#hashCode()
72 public int hashCode() {
76 * @see java.lang.Object#toString()
78 public String toString() {