1 16 package org.apache.cocoon.portal.layout; 17 18 import java.util.Map ; 19 import java.util.Iterator ; 20 import java.util.HashSet ; 21 import java.util.Set ; 22 23 import org.apache.commons.collections.map.LinkedMap; 24 import org.apache.pluto.om.common.Parameter; 25 import org.apache.cocoon.portal.pluto.om.common.ParameterImpl; 26 27 34 public abstract class AbstractParameters 35 implements Parameters, Cloneable { 36 37 protected Map parameters = new LinkedMap(); 38 39 42 public final Map getParameters() { 43 return parameters; 44 } 45 46 public final Set getCastorParameters() { 47 Set set = new HashSet (this.parameters.size()); 48 Iterator iterator = this.parameters.entrySet().iterator(); 49 Map.Entry entry; 50 while (iterator.hasNext()) 51 { 52 entry = (Map.Entry ) iterator.next(); 53 ParameterImpl param = new ParameterImpl(); 54 param.setName((String )entry.getKey()); 55 param.setValue((String )entry.getValue()); 56 set.add(param); 57 } 58 return set; 59 } 60 61 public void addParameter(Parameter parameter) { 62 parameters.put(parameter.getName(), parameter.getValue()); 63 } 64 65 68 protected Object clone() throws CloneNotSupportedException { 69 AbstractParameters clone = (AbstractParameters)super.clone(); 70 71 clone.parameters = new LinkedMap(this.parameters); 72 73 return clone; 74 } 75 } 76 | Popular Tags |