View Javadoc

1   /*
2    * <cvs:source>$Source: /devel/astrogrid/community/common/src/java/org/astrogrid/community/common/identifier/UniqueIdentifier.java,v $</cvs:source>
3    * <cvs:author>$Author: dave $</cvs:author>
4    * <cvs:date>$Date: 2004/06/18 13:45:20 $</cvs:date>
5    * <cvs:version>$Revision: 1.2 $</cvs:version>
6    *
7    * <cvs:log>
8    *   $Log: UniqueIdentifier.java,v $
9    *   Revision 1.2  2004/06/18 13:45:20  dave
10   *   Merged development branch, dave-dev-200406081614, into HEAD
11   *
12   *   Revision 1.1.2.2  2004/06/17 13:38:58  dave
13   *   Tidied up old CVS log entries
14   *
15   * </cvs:log>
16   *
17   */
18  package org.astrogrid.community.common.identifier ;
19  
20  import java.rmi.server.UID ;
21  
22  /***
23   * A base class for unique identifiers.
24   * This enable us to swap between different identifier generator implementations.
25   *
26   */
27  public class UniqueIdentifier
28      {
29      /***
30       * Create a new unique identifier.
31       *
32       */
33      public UniqueIdentifier()
34          {
35          //
36          // Use the RMI library to generate a new identifier.
37          UID uid = new UID() ;
38          this.string = uid.toString() ;
39          }
40  
41      /***
42       * Create an identifier from a string.
43       *
44       */
45      public UniqueIdentifier(String value)
46          {
47          this.string = value ;
48          }
49  
50      /***
51       * An internal string representation of the identifier.
52       *
53       */
54      private String string ;
55  
56      /***
57       * Convert the identifier to a String.
58       *
59       */
60      public String toString()
61          {
62          return this.string ;
63          }
64  
65      }
66  
67