1 16 package org.apache.cocoon.components.flow.java; 17 18 19 import java.util.ArrayList ; 20 import java.util.Iterator ; 21 import java.util.Map ; 22 23 import org.apache.commons.jxpath.DynamicPropertyHandler; 24 25 31 public class VarMapHandler implements DynamicPropertyHandler { 32 33 public String [] getPropertyNames(Object object){ 34 35 Map map = ((VarMap)object).getMap(); 36 ArrayList list = new ArrayList (); 37 for(Iterator i=map.keySet().iterator(); i.hasNext();) 38 list.add(i.next()); 39 String [] array = new String [list.size()]; 40 list.toArray(array); 41 return array; 42 } 43 44 public Object getProperty(Object object, String property){ 45 46 Map map = ((VarMap)object).getMap(); 47 return map.get(property); 48 } 49 50 public void setProperty(Object object, String property, Object value){ 51 52 Map map = ((VarMap)object).getMap(); 53 map.put(property, value); 54 } 55 } 56 | Popular Tags |