Package org.xwiki.model.validation
Interface EntityNameValidation
-
- All Known Implementing Classes:
AbstractEntityNameValidation
@Role public interface EntityNameValidationDefine a strategy to validate or transform an entity reference.- Since:
- 12.0RC1
- Version:
- $Id: 8dcc0f3031bbe9292223c21b5ed2c48025b94154 $
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description booleanisValid(String name)Validate a name against a set of rules: usually a pattern is used to validate a name.booleanisValid(EntityReference entityReference)Validate that the givenEntityReferencerespects the current policy.Stringtransform(String name)Transforms a name such asisValid(String)returntrue.EntityReferencetransform(EntityReference entityReference)Aims at transforming an entity reference such asisValid(EntityReference)returns true.
-
-
-
Method Detail
-
transform
String transform(String name)
Transforms a name such asisValid(String)returntrue.- Parameters:
name- a name that should be transformed to be validated.- Returns:
- a new name with some changes to make it valid. Or exactly
nameif it was already valid.
-
isValid
boolean isValid(String name)
Validate a name against a set of rules: usually a pattern is used to validate a name.- Parameters:
name- the name to validate.- Returns:
trueif it's correct according to the current policy.
-
transform
EntityReference transform(EntityReference entityReference)
Aims at transforming an entity reference such asisValid(EntityReference)returns true. Note that this method should return exactlyentityReferenceifisValid(EntityReference)already returns true for it.- Parameters:
entityReference- the entity reference on which to perform transformation.- Returns:
- a new
EntityReferencewith the fewer possible transformation to make it passisValid(EntityReference).
-
isValid
boolean isValid(EntityReference entityReference)
Validate that the givenEntityReferencerespects the current policy.- Parameters:
entityReference- the entity reference to check- Returns:
trueif the policy is respected.
-
-