Clover coverage report - PMD - 3.9 Coverage timestamp: Tue Dec 19 2006 09:38:44 EST FRAMES NO FRAMES |
file stats: | LOC: | 56 |  | Methods: | 2
| NCLOC: | 16 |  | Classes: | 1
Source file | Conditionals | Statements | Methods | TOTAL
AbstractScalarProperty.java | 100% | 100% | 100% | 100% |

1 |  | package net.sourceforge.pmd.properties;
2 |  |
3 |  | import net.sourceforge.pmd.util.StringUtil;
4 |  |
5 |  | /**
6 |  | * No, subclasses are not necessarily scalar per se, they're just easy to parse without error.
7 |  | * If you can come up with a better name...
8 |  | *
9 |  | * @author Brian Remedios
10 |  | * @version $Revision$
11 |  | */
12 |  | public abstract class AbstractScalarProperty extends AbstractPMDProperty {
13 |  |
14 |  | /**
15 |  | * Constructor for AbstractScalarProperty.
16 |  | * @param theName String
17 |  | * @param theDescription String
18 |  | * @param theDefault Object
19 |  | * @param theUIOrder float
20 |  | */
21 | 414 | public AbstractScalarProperty(String theName, String theDescription, Object theDefault, float theUIOrder) {
22 | 414 | super(theName, theDescription, theDefault, theUIOrder);
23 |  | }
24 |  |
25 |  | /**
26 |  | * Method createFrom.
27 |  | * @param value String
28 |  | * @return Object
29 |  | */
30 |  | protected abstract Object createFrom(String value);
31 |  |
32 |  | /**
33 |  | * Method arrayFor.
34 |  | * @param size int
35 |  | * @return Object[]
36 |  | */
37 |  | protected abstract Object[] arrayFor(int size);
38 |  |
39 |  | /**
40 |  | * Method valueFrom.
41 |  | * @param valueString String
42 |  | * @return Object[]
43 |  | * @throws IllegalArgumentException
44 |  | * @see net.sourceforge.pmd.PropertyDescriptor#valueFrom(String)
45 |  | */
46 | 457 | public Object valueFrom(String valueString) throws IllegalArgumentException {
47 |  |
48 | 451 | if (maxValueCount() == 1) return createFrom(valueString);
49 |  |
50 | 6 | String[] strValues = StringUtil.substringsOf(valueString, multiValueDelimiter);
51 |  |
52 | 6 | Object[] values = arrayFor(strValues.length);
53 | 44 | for (int i=0; i<strValues.length; i++) values[i] = createFrom(strValues[i]);
54 | 6 | return values;
55 |  | }
56 |  | }