public class DefaultFeatureValidation extends Object implements FeatureValidation
The geometry is first tested to see if it is null, and if it is null, then it is tested to see if it is allowed to be null by calling isNillable().
ALL, PRIORITY_COMPLEX, PRIORITY_INVOLVED, PRIORITY_SIMPLE, PRIORITY_TRIVIAL| Constructor and Description |
|---|
DefaultFeatureValidation()
No argument constructor, required by the Java Bean Specification.
|
| Modifier and Type | Method and Description |
|---|---|
protected LineString |
getDefaultLineString(SimpleFeature feature)
Retrives a single LineString from feature.getDefaultGeometry.
|
String |
getDescription()
Override getDescription.
|
String |
getName()
Access the user's name for this test.
|
int |
getPriority()
The priority level used to schedule this Validation.
|
String |
getTypeRef()
Access typeRef property.
|
String[] |
getTypeRefs()
Implementation of getTypeNames.
|
void |
setDescription(String description)
Sets the description of this validation.
|
void |
setName(String name)
Sets the name of this validation.
|
void |
setTypeRef(String typeRef)
Set typeRef to typeRef.
|
boolean |
validate(SimpleFeature feature,
SimpleFeatureType type,
ValidationResults results)
Validation test for feature.
|
public DefaultFeatureValidation()
public final void setName(String name)
setName in interface Validationname - The name of this validation.Validation.setName(java.lang.String)public final String getName()
getName in interface ValidationValidation.getName()public final void setDescription(String description)
setDescription in interface Validationdescription - The description of the validation.Validation.setDescription(java.lang.String)public final String getDescription()
Returns the description of this validation as a string.
getDescription in interface ValidationValidation.getDescription()public int getPriority()
getPriority in interface ValidationValidation.getPriority()public String[] getTypeRefs()
getTypeRefs in interface ValidationValidation.getTypeRefs()public String getTypeRef()
public void setTypeRef(String typeRef)
typeRef - The typeRef in the format dataStoreId:typeNamepublic boolean validate(SimpleFeature feature, SimpleFeatureType type, ValidationResults results)
Description of test ...
validate in interface FeatureValidationfeature - The Feature to be validatedtype - The FeatureType of the featureresults - The storage for error messages.true if the feature is a valid geometry.FeatureValidation.validate(org.opengis.feature.simple.SimpleFeature, org.opengis.feature.simple.SimpleFeatureType, org.geotools.validation.ValidationResults)protected LineString getDefaultLineString(SimpleFeature feature) throws ClassCastException
If feature contains MultiLineString (or GeometryCollection ) of length 1 it will be deemed sufficient. Shapefiles are determined to work with MultiLineStrings of length 1 forcing the creation of this method.
If feature.getDefaultGeometry returns null this method will return null. For
most cases the validation should just be abandoned with a warning; the user can separately
specify a NullZero check. This will prevent the same error (a null value) being reproted by
each and every SpatialValidation test.
feature - FeaturenullClassCastException - If feature.getDefaultGeometry is the wrong typeCopyright © 1996–2019 Geotools. All rights reserved.