Package org.xwiki.model.validation
Interface EntityNameValidation
-
- All Known Implementing Classes:
AbstractEntityNameValidation
@Role public interface EntityNameValidation
Define 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 boolean
isValid(String name)
Validate a name against a set of rules: usually a pattern is used to validate a name.boolean
isValid(EntityReference entityReference)
Validate that the givenEntityReference
respects the current policy.String
transform(String name)
Transforms a name such asisValid(String)
returntrue
.EntityReference
transform(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
name
if 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:
true
if 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 exactlyentityReference
ifisValid(EntityReference)
already returns true for it.- Parameters:
entityReference
- the entity reference on which to perform transformation.- Returns:
- a new
EntityReference
with the fewer possible transformation to make it passisValid(EntityReference)
.
-
isValid
boolean isValid(EntityReference entityReference)
Validate that the givenEntityReference
respects the current policy.- Parameters:
entityReference
- the entity reference to check- Returns:
true
if the policy is respected.
-
-