1 16 package org.apache.cocoon.portal.coplets.basket; 17 18 import java.io.Serializable ; 19 import java.util.HashMap ; 20 import java.util.Iterator ; 21 import java.util.Map ; 22 23 24 31 public class AbstractItem implements Serializable { 32 33 protected static long currentId = System.currentTimeMillis(); 34 35 36 protected Map attributes = new HashMap (); 37 38 39 protected long id; 40 41 public AbstractItem() { 42 synchronized ( this.getClass() ) { 43 currentId++; 44 this.id = currentId; 45 } 46 } 47 48 49 public Object getAttribute(String name) { 50 return this.attributes.get(name); 51 } 52 53 54 public void setAttribute(String name, Object value) { 55 this.attributes.put(name, value); 56 } 57 58 59 public Iterator getAttributeNames() { 60 return this.attributes.keySet().iterator(); 61 } 62 63 64 public void removeAttribute(String name) { 65 this.attributes.remove(name); 66 } 67 68 69 public boolean hasAttribute(String name) { 70 return this.attributes.containsKey(name); 71 } 72 73 public long getId() { 74 return this.id; 75 } 76 } 77 | Popular Tags |