1 package org.sourceforge.jemm.client.id;
2
3 import org.sourceforge.jemm.types.ID;
4
5 /**
6 * An ID which must be created via the TrackedIDFactory and implements
7 * the Flyweight pattern, ensuring that TrackedIDs with the same number
8 * are always the same object.
9 *
10 * Do not keep a reference to one of these objects in client code as
11 * the Weak reference availability of a TrackedID is used to tell the
12 * garbage collector on the server that this ID is no longer being used
13 * by the client.
14 *
15 * @author Paul Keeble
16 *
17 */
18 public class TrackedID extends ID {
19
20 private static final long serialVersionUID = 1L;
21
22 /**
23 * Protected since this Object should only be created by
24 * the TrackedIDFactory.
25 *
26 * @param id
27 */
28 protected TrackedID(ID id) {
29 super(id.getIDValue());
30 }
31
32 @Override
33 public String toString() {
34 return "T-ID(" + getIDValue() + ")";
35 }
36 }