1 16 package org.apache.commons.jxpath; 17 18 import java.util.Iterator ; 19 import java.util.Map ; 20 import java.util.Set ; 21 22 28 public class MapDynamicPropertyHandler implements DynamicPropertyHandler { 29 30 private static final String [] STRING_ARRAY = new String [0]; 31 32 35 public String [] getPropertyNames(Object object) { 36 Map map = (Map ) object; 37 Set set = map.keySet(); 38 String names[] = new String [set.size()]; 39 Iterator it = set.iterator(); 40 for (int i = 0; i < names.length; i++) { 41 names[i] = String.valueOf(it.next()); 42 } 43 return names; 44 } 45 46 49 public Object getProperty(Object object, String propertyName) { 50 return ((Map ) object).get(propertyName); 51 } 52 53 56 public void setProperty(Object object, String propertyName, Object value) { 57 ((Map ) object).put(propertyName, value); 58 } 59 } | Popular Tags |