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.checkState;
18
19 import com.google.common.annotations.VisibleForTesting;
20
21 public class NumberDefinition
22 extends AbstractDefinition<NumberDefinition> {
23
24 public static final String INITIAL_VALUE = "0";
25
26
27
28
29 int fieldNumber = 0;
30
31
32
33
34 int increment = 1;
35
36 public NumberDefinition() {
37 super();
38 setInitialValue(INITIAL_VALUE);
39 }
40
41 public int getFieldNumber() {
42 return fieldNumber;
43 }
44
45 @VisibleForTesting
46 public NumberDefinition setFieldNumber(final int fieldNumber) {
47 this.fieldNumber = fieldNumber;
48 return this;
49 }
50
51 public int getIncrement() {
52 return increment;
53 }
54
55 @VisibleForTesting
56 public NumberDefinition setIncrement(final int increment) {
57 this.increment = increment;
58 return this;
59 }
60
61 @Override
62 public void check() {
63 super.check();
64 checkState(getInitialValue().isPresent(), "the initial value must not be empty");
65 checkState(fieldNumber >= 0, "the field number must be >= 0");
66 }
67 }