Last change
on this file since 7489 was 7489, checked in by Don-vip, 10 years ago |
fix #10393 - Validation of URLs and e-mails in relevant tags, using modified subset of Apache Commons Validator 1.4
|
File size:
1.2 KB
|
Line | |
---|
1 | // License: GPL. For details, see LICENSE file.
|
---|
2 | package org.openstreetmap.josm.data.validation.routines;
|
---|
3 |
|
---|
4 | /**
|
---|
5 | * Abstract validator superclass to extend Apache Validator routines.
|
---|
6 | * @since 7489
|
---|
7 | */
|
---|
8 | public abstract class AbstractValidator {
|
---|
9 |
|
---|
10 | private String errorMessage;
|
---|
11 | private String fix;
|
---|
12 |
|
---|
13 | /**
|
---|
14 | * Tests validity of a given value.
|
---|
15 | * @param value Value to test
|
---|
16 | * @return {@code true} if value is valid, {@code false} otherwise
|
---|
17 | */
|
---|
18 | public abstract boolean isValid(String value);
|
---|
19 |
|
---|
20 | /**
|
---|
21 | * Replies the error message.
|
---|
22 | * @return the errorMessage
|
---|
23 | */
|
---|
24 | public final String getErrorMessage() {
|
---|
25 | return errorMessage;
|
---|
26 | }
|
---|
27 |
|
---|
28 | /**
|
---|
29 | * Sets the error message.
|
---|
30 | * @param errorMessage the errorMessage
|
---|
31 | */
|
---|
32 | protected final void setErrorMessage(String errorMessage) {
|
---|
33 | this.errorMessage = errorMessage;
|
---|
34 | }
|
---|
35 |
|
---|
36 | /**
|
---|
37 | * Replies the fixed value, if any.
|
---|
38 | * @return the fixed value or {@code null}
|
---|
39 | */
|
---|
40 | public final String getFix() {
|
---|
41 | return fix;
|
---|
42 | }
|
---|
43 |
|
---|
44 | /**
|
---|
45 | * Sets the fixed value.
|
---|
46 | * @param fix the fixed value, if any
|
---|
47 | */
|
---|
48 | protected final void setFix(String fix) {
|
---|
49 | this.fix = fix;
|
---|
50 | }
|
---|
51 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.