Class InternetTags
- java.lang.Object
-
- org.openstreetmap.josm.data.validation.Test
-
- org.openstreetmap.josm.data.validation.Test.TagTest
-
- org.openstreetmap.josm.data.validation.tests.InternetTags
-
- All Implemented Interfaces:
OsmPrimitiveVisitor
public class InternetTags extends Test.TagTest
Performs validation tests on internet-related tags (websites, e-mail addresses, etc.).- Since:
- 7489
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.openstreetmap.josm.data.validation.Test
Test.TagTest
-
-
Field Summary
Fields Modifier and Type Field Description private static String[]
EMAIL_KEYS
List of keys subject to email validation.static int
INVALID_EMAIL
Error code for an invalid e-mailstatic int
INVALID_URL
Error code for an invalid URLprivate static String[]
URL_KEYS
List of keys subject to URL validation.-
Fields inherited from class org.openstreetmap.josm.data.validation.Test
checkBeforeUpload, checkEnabled, description, enabled, errors, IN_DOWNLOADED_AREA, IN_DOWNLOADED_AREA_STRICT, isBeforeUpload, name, partialSelection, progressMonitor, stopwatch, testBeforeUpload
-
-
Constructor Summary
Constructors Constructor Description InternetTags()
Constructs a newInternetTags
test.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
check(OsmPrimitive p)
Checks the tags of the given primitive.private boolean
doTest(OsmPrimitive p, String k, String[] keys, AbstractValidator validator, int code)
Potentially validates a given primitive key against a given validator.private List<TestError>
doValidateTag(OsmPrimitive p, String k, String v, AbstractValidator validator, int code)
Validates a given primitive tag against a given validator.List<TestError>
validateTag(OsmPrimitive p, String k, AbstractValidator validator, int code)
Validates a given primitive tag against a given validator.-
Methods inherited from class org.openstreetmap.josm.data.validation.Test.TagTest
includeOtherSeverityChecks, visit, visit, visit
-
Methods inherited from class org.openstreetmap.josm.data.validation.Test
addGui, clear, deletePrimitivesIfNeeded, endTest, fixError, getErrors, getName, getSource, initialize, isBuilding, isCanceled, isFixable, isPrimitiveUsable, isResidentialArea, ok, setBeforeUpload, setPartialSelection, setShowElements, startTest, testBeforeUpload, visit
-
-
-
-
Field Detail
-
INVALID_URL
public static final int INVALID_URL
Error code for an invalid URL- See Also:
- Constant Field Values
-
INVALID_EMAIL
public static final int INVALID_EMAIL
Error code for an invalid e-mail- See Also:
- Constant Field Values
-
EMAIL_KEYS
private static final String[] EMAIL_KEYS
List of keys subject to email validation.
-
-
Constructor Detail
-
InternetTags
public InternetTags()
Constructs a newInternetTags
test.
-
-
Method Detail
-
doTest
private boolean doTest(OsmPrimitive p, String k, String[] keys, AbstractValidator validator, int code)
Potentially validates a given primitive key against a given validator.- Parameters:
p
- The OSM primitive to testk
- The key to validatekeys
- The list of keys to check. Ifk
is not inside this collection, do nothingvalidator
- The validator to run ifk
is insidekeys
code
- The error code to set if the validation fails- Returns:
true
if the validation fails. In this case, a new error has been created.
-
validateTag
public List<TestError> validateTag(OsmPrimitive p, String k, AbstractValidator validator, int code)
Validates a given primitive tag against a given validator.- Parameters:
p
- The OSM primitive to testk
- The key to validatevalidator
- The validator to runcode
- The error code to set if the validation fails- Returns:
- The error if the validation fails,
null
otherwise - Since:
- 7824, 14803 (return type)
-
doValidateTag
private List<TestError> doValidateTag(OsmPrimitive p, String k, String v, AbstractValidator validator, int code)
Validates a given primitive tag against a given validator.- Parameters:
p
- The OSM primitive to testk
- The key to validatev
- The value to validate. May benull
to usep.get(k)
validator
- The validator to runcode
- The error code to set if the validation fails- Returns:
- The error if the validation fails,
null
otherwise
-
check
public void check(OsmPrimitive p)
Description copied from class:Test.TagTest
Checks the tags of the given primitive.- Specified by:
check
in classTest.TagTest
- Parameters:
p
- The primitive to test
-
-