1
2
3
4
5
6
7
8
9
10
11
12
13
14 package org.basepom.mojo.propertyhelper.definitions;
15
16 import java.io.File;
17 import java.util.Arrays;
18
19 public final class DefinitionHelper {
20
21 public static UuidDefinition uuidDefinition(String id) {
22 return new UuidDefinition(id);
23 }
24
25 public static NumberDefinition numberDefinition(String id) {
26 return new NumberDefinition(id);
27 }
28
29 public static DateDefinition dateDefinition(String id) {
30 return new DateDefinition(id);
31 }
32
33 public static StringDefinition stringDefinition(String id) {
34 return new StringDefinition(id);
35 }
36
37 public static PropertyGroupDefinition propertyGroupDefinition(String id) {
38 return new PropertyGroupDefinition(id);
39 }
40
41 public static PropertyDefinition propertyDefinition(String name, String value) {
42 return new PropertyDefinition(name, value);
43 }
44
45 public static void setOnMissingProperty(FieldDefinition<?> fieldDefinition, String value) {
46 fieldDefinition.setOnMissingProperty(value);
47 }
48
49 public static void setOnMissingFileProperty(FieldDefinition<?> fieldDefinition, String value) {
50 fieldDefinition.setOnMissingFileProperty(value);
51 }
52
53 public static void setOnMissingFile(FieldDefinition<?> fieldDefinition, String value) {
54 fieldDefinition.setOnMissingFile(value);
55 }
56
57 public static void setPropertyFile(FieldDefinition<?> fieldDefinition, File value) {
58 fieldDefinition.propertyFile = value;
59 }
60
61 public static void setInitialValue(FieldDefinition<?> fieldDefinition, String initialValue) {
62 fieldDefinition.initialValue = initialValue;
63 }
64
65
66 public static void setValue(UuidDefinition uuidDefinition, String value) {
67 uuidDefinition.value = value;
68 }
69
70
71 public static void setValue(DateDefinition dateDefinition, Long value) {
72 dateDefinition.value = value;
73 }
74
75 public static void setTimezone(DateDefinition dateDefinition, String timezone) {
76 dateDefinition.timezone = timezone;
77 }
78
79 public static void setFormat(DateDefinition dateDefinition, String format) {
80 dateDefinition.format = format;
81 }
82
83
84 public static void setFieldNumber(NumberDefinition numberDefinition, int fieldNumber) {
85 numberDefinition.fieldNumber = fieldNumber;
86 }
87
88
89
90 public static void setValues(StringDefinition stringDefinition, String ... values) {
91 stringDefinition.setValues(Arrays.asList(values));
92 }
93
94 public static void setBlankIsValid(StringDefinition stringDefinition, boolean blankIsValid) {
95 stringDefinition.blankIsValid = blankIsValid;
96 }
97
98 public static void setOnMissingValue(StringDefinition stringDefinition, String onMissingValue) {
99 stringDefinition.setOnMissingValue(onMissingValue);
100 }
101
102
103 public static void setProperties(PropertyGroupDefinition propertyGroupDefinition, PropertyDefinition ... propertyDefinitions) {
104 propertyGroupDefinition.setProperties(propertyDefinitions);
105 }
106
107 public static void setOnMissingField(PropertyGroupDefinition propertyGroupDefinition, String value) {
108 propertyGroupDefinition.setOnMissingField(value);
109 }
110 }