1
2
3
4 package net.sourceforge.pmd.lang.rule.properties;
5
6 import java.util.Map;
7
8 import net.sourceforge.pmd.PropertyDescriptorFactory;
9 import net.sourceforge.pmd.lang.rule.properties.factories.BasicPropertyDescriptorFactory;
10
11
12
13
14
15
16 public class StringProperty extends AbstractProperty<String> {
17
18 public static final PropertyDescriptorFactory FACTORY = new BasicPropertyDescriptorFactory<StringProperty>(String.class) {
19
20 public StringProperty createWith(Map<String, String> valuesById) {
21 return new StringProperty(
22 nameIn(valuesById),
23 descriptionIn(valuesById),
24 defaultValueIn(valuesById),
25 0f);
26 }
27 };
28
29
30
31
32
33
34
35
36 public StringProperty(String theName, String theDescription, String theDefaultValue, float theUIOrder) {
37 super(theName, theDescription, theDefaultValue, theUIOrder);
38 }
39
40
41
42
43 protected String defaultAsString() {
44 return defaultValue();
45 }
46
47
48
49
50
51
52 public Class<String> type() {
53 return String.class;
54 }
55
56
57
58
59
60
61
62 public String valueFrom(String valueString) {
63 return valueString;
64 }
65 }