1 package net.sourceforge.pmd.properties; 2 3 import net.sourceforge.pmd.util.StringUtil; 4 5 12 public abstract class AbstractScalarProperty extends AbstractPMDProperty { 13 14 21 public AbstractScalarProperty(String theName, String theDescription, Object theDefault, float theUIOrder) { 22 super(theName, theDescription, theDefault, theUIOrder); 23 } 24 25 30 protected abstract Object createFrom(String value); 31 32 37 protected abstract Object [] arrayFor(int size); 38 39 46 public Object valueFrom(String valueString) throws IllegalArgumentException { 47 48 if (maxValueCount() == 1) return createFrom(valueString); 49 50 String [] strValues = StringUtil.substringsOf(valueString, multiValueDelimiter); 51 52 Object [] values = arrayFor(strValues.length); 53 for (int i=0; i<strValues.length; i++) values[i] = createFrom(strValues[i]); 54 return values; 55 } 56 } 57 | Popular Tags |