-
Notifications
You must be signed in to change notification settings - Fork 302
/
Copy pathValidationProperty.java
97 lines (87 loc) · 2.81 KB
/
ValidationProperty.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
/*
* This file is part of git-commit-id-maven-plugin
* Originally invented by Konrad 'ktoso' Malawski <[email protected]>
*
* git-commit-id-maven-plugin is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* git-commit-id-maven-plugin is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with git-commit-id-maven-plugin. If not, see <http://www.gnu.org/licenses/>.
*/
package pl.project13.maven.validation;
/**
* Allows to configure a single validation action that shall be performed
* when running the {@link ValidationMojo}.
* A full configuration may like:
* <pre>{@code
* <validationProperties>
* <validationProperty>
* <name>validating project version</name>
* <value>${project.version}</value>
* <shouldMatchTo><![CDATA[^.*(?<!-SNAPSHOT)$]]></shouldMatchTo>
* </validationProperty>
* </validationProperties>
* }</pre>
*/
public class ValidationProperty {
private String name;
private String value;
private String shouldMatchTo;
public ValidationProperty() {}
ValidationProperty(String name, String value, String shouldMatchTo) {
this.name = name;
this.value = value;
this.shouldMatchTo = shouldMatchTo;
}
/**
* Sets a descriptive name that will be used to be able to identify the validation that
* does not match up (will be displayed in the error message).
*
* @param name The name that shall be used to identify the validation
*/
public void setName(String name) {
this.name = name;
}
/**
* Sets the value that needs to be validated.
*
* @param value The value that needs to be validated.
*/
public void setValue(String value) {
this.value = value;
}
/**
* Sets the expectation what the given value should match to.
*
* @param shouldMatchTo The expectation what the given value should match to.
*/
public void setShouldMatchTo(String shouldMatchTo) {
this.shouldMatchTo = shouldMatchTo;
}
/**
* @return A descriptive name that will be used to be able to identify the validation that
* does not match up (will be displayed in the error message).
*/
public String getName() {
return name;
}
/**
* @return The value that needs to be validated.
*/
public String getValue() {
return value;
}
/**
* @return The expectation what the given value should match to.
*/
public String getShouldMatchTo() {
return shouldMatchTo;
}
}