1 /**
2 * BSD-style license; for more info see http://pmd.sourceforge.net/license.html
3 */
4 package net.sourceforge.pmd;
5
6 import java.util.Map;
7
8 /**
9 * A factory to create {@link PropertyDescriptor}s based on a map of values.
10 *
11 * @author Brian Remedios
12 */
13 public interface PropertyDescriptorFactory {
14
15 /**
16 * The type of the value of the {@link PropertyDescriptor} created by this
17 * factory.
18 *
19 * @return the type of the value.
20 */
21 Class<?> valueType();
22
23 /**
24 * Denote the identifiers of the expected fields paired with booleans
25 * denoting whether they are required (non-null) or not.
26 *
27 * @return Map
28 */
29 Map<String, Boolean> expectedFields();
30
31 /**
32 * Create a property descriptor of the appropriate type using the values
33 * provided.
34 *
35 * @param valuesById the map of values
36 * @return a new and initialized {@link PropertyDescriptor}
37 */
38 PropertyDescriptor<?> createWith(Map<String, String> valuesById);
39 }