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>(
19 String.class) {
20
21 public StringProperty createWith(Map<String, String> valuesById) {
22 return new StringProperty(nameIn(valuesById), descriptionIn(valuesById), defaultValueIn(valuesById), 0f);
23 }
24 };
25
26
27
28
29
30
31
32
33
34 public StringProperty(String theName, String theDescription, String theDefaultValue, float theUIOrder) {
35 super(theName, theDescription, theDefaultValue, theUIOrder);
36 }
37
38
39
40
41 protected String defaultAsString() {
42 return defaultValue();
43 }
44
45
46
47
48
49
50 public Class<String> type() {
51 return String.class;
52 }
53
54
55
56
57
58
59
60 public String valueFrom(String valueString) {
61 return valueString;
62 }
63 }