1 /*
2 * Copyright (c) 2005 Regents of the University of California (Regents). Created
3 * by TELS, Graduate School of Education, University of California at Berkeley.
4 *
5 * This software is distributed under the GNU Lesser General Public License, v2.
6 *
7 * Permission is hereby granted, without written agreement and without license
8 * or royalty fees, to use, copy, modify, and distribute this software and its
9 * documentation for any purpose, provided that the above copyright notice and
10 * the following two paragraphs appear in all copies of this software.
11 *
12 * REGENTS SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
13 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
14 * PURPOSE. THE SOFTWAREAND ACCOMPANYING DOCUMENTATION, IF ANY, PROVIDED
15 * HEREUNDER IS PROVIDED "AS IS". REGENTS HAS NO OBLIGATION TO PROVIDE
16 * MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
17 *
18 * IN NO EVENT SHALL REGENTS BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT,
19 * SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOST PROFITS,
20 * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF
21 * REGENTS HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
22 */
23 package net.sf.sail.core.uuid;
24
25 import java.beans.Encoder;
26 import java.beans.Expression;
27 import java.beans.PersistenceDelegate;
28
29 import net.sf.sail.core.curnit.SAILXMLEncoder;
30
31 import org.doomdark.uuid.UUID;
32
33
34 /**
35 * <p>
36 * Represents UUID in pod ID space.
37 * </p>
38 *
39 * @author turadg
40 */
41 public class PodUuid extends UUID {
42
43 /**
44 *
45 */
46 private static final long serialVersionUID = -404437174334687209L;
47
48 {
49 PersistenceDelegate delegate = new PersistenceDelegate() {
50 @Override
51 protected Expression instantiate(Object oldInstance, Encoder out) {
52 return new Expression(oldInstance, oldInstance.getClass(),
53 "new", new Object[] { ((PodUuid) oldInstance)
54 .toString() });
55 }
56 };
57 SAILXMLEncoder.registerPersistenceDelegate(PodUuid.class, delegate);
58 }
59
60 public PodUuid(byte[] bs) {
61 super(bs);
62 }
63
64 /**
65 * Constructor necessary for XMLEncoder
66 *
67 * @param stringRepresentation
68 */
69 public PodUuid(String stringRepresentation) {
70 super(stringRepresentation);
71 }
72 }