1 9 package org.jboss.portal.core.impl.tree; 10 11 import java.io.IOException ; 12 import java.io.ObjectInputStream ; 13 import java.io.ObjectOutputStream ; 14 import java.io.Serializable ; 15 16 import org.jboss.portal.common.util.UUIDGenerator; 17 18 24 public class Property implements Serializable 25 { 26 27 28 private static final UUIDGenerator generator = new UUIDGenerator(); 29 30 31 private String name; 32 33 34 private Object value; 35 36 37 private String id; 38 39 public Property(String name, Object value) 40 { 41 if (name == null) 42 { 43 throw new IllegalArgumentException ("name cannot be null"); 44 } 45 this.name = name; 46 this.value = value; 47 this.id = generator.generateKey(); 48 } 49 50 public String getID() 51 { 52 return id; 53 } 54 55 public String getName() 56 { 57 return name; 58 } 59 60 public void setName(String name) 61 { 62 this.name = name; 63 } 64 65 public Object getValue() 66 { 67 return value; 68 } 69 70 private void writeObject(ObjectOutputStream out) throws IOException 71 { 72 out.writeObject(name); 73 out.writeObject(value); 74 } 75 76 private void readObject(ObjectInputStream in) throws IOException , ClassNotFoundException 77 { 78 name = (String )in.readObject(); 79 value = in.readObject(); 80 } 81 82 public String toString() 83 { 84 return "Property[" + name + "," + value + "," + id + "]"; 85 } 86 } 87 | Popular Tags |