1
2
3
4
5
6
7
8
9
10
11
12
13
14
15 package org.basepom.mojo.propertyhelper.beans;
16
17 import static com.google.common.base.Preconditions.checkNotNull;
18
19 import java.util.List;
20 import java.util.Objects;
21
22 import com.google.common.annotations.VisibleForTesting;
23 import com.google.common.collect.ImmutableList;
24
25 public class StringDefinition
26 extends AbstractDefinition<StringDefinition> {
27
28
29
30
31 List<String> values = ImmutableList.of();
32
33
34
35
36 boolean blankIsValid = true;
37
38
39
40
41 IgnoreWarnFail onMissingValue = IgnoreWarnFail.FAIL;
42
43 public StringDefinition() {
44 }
45
46 public List<String> getValues() {
47 return values;
48 }
49
50 @VisibleForTesting
51 public StringDefinition setValues(final List<String> values) {
52 checkNotNull(values, "values is null");
53 final ImmutableList.Builder<String> builder = ImmutableList.builder();
54 for (String value : values) {
55 builder.add(Objects.requireNonNullElse(value, ""));
56 }
57 this.values = builder.build();
58 return this;
59 }
60
61 public boolean isBlankIsValid() {
62 return blankIsValid;
63 }
64
65 @VisibleForTesting
66 public StringDefinition setBlankIsValid(final boolean blankIsValid) {
67 this.blankIsValid = blankIsValid;
68 return this;
69 }
70
71 public IgnoreWarnFail getOnMissingValue() {
72 return onMissingValue;
73 }
74
75 @VisibleForTesting
76 public StringDefinition setOnMissingValue(final String onMissingValue) {
77 checkNotNull(onMissingValue, "onMissingValue is null");
78 this.onMissingValue = IgnoreWarnFail.forString(onMissingValue);
79 return this;
80 }
81 }