1 24 package org.riotfamily.common.beans.propertyeditors; 25 26 import java.beans.PropertyEditorSupport ; 27 28 import org.springframework.util.StringUtils; 29 30 34 public class IntArrayPropertyEditor extends PropertyEditorSupport { 35 36 public String getAsText() { 37 Integer [] array = (Integer []) getValue(); 38 return StringUtils.arrayToCommaDelimitedString(array); 39 } 40 41 public void setAsText(String text) throws IllegalArgumentException { 42 String [] s = StringUtils.commaDelimitedListToStringArray(text); 43 Integer [] array = new Integer [s.length]; 44 for (int i = 0; i < s.length; i++) { 45 array[i] = Integer.valueOf(s[i]); 46 } 47 setValue(array); 48 } 49 } 50 | Popular Tags |