org.zaval.lw.mask
Interface MaskValidator
- All Known Implementing Classes:
- BasicMaskValidator, DateMaskValidator
- public interface MaskValidator
This interface is used with a masked text to perform mask validation process.
The interface has the following functional points:
-
Provides information what mask tags are handled with the validator.
For the purpose
isHandlesTag method is used.
-
Defines types of mask elements that are handled by this validator.
Any mask element is bound with a type that defines rules which should be use to handle
the mask element.
-
Defines blank characters for handled mask tags by
getBlankChar method.
-
Completes the specified mask element by
completeValue method.
-
Validates the specified mask element by
isValidValue method.
|
Method Summary |
java.lang.String |
completeValue(MaskElement e,
java.lang.String newValue)
Completes the new value for the specified mask element. |
char |
getBlankChar(char tag)
Gets the blank character for the specified mask tag. |
int |
getTypeByTag(char tag)
Gets the type for the specified mask tag. |
boolean |
isHandledTag(char tag)
Tests if the mask tag is handled with the validator. |
boolean |
isValidValue(MaskElement e,
java.lang.String newValue)
Tests if the specified value is valid for the mask element. |
isHandledTag
public boolean isHandledTag(char tag)
- Tests if the mask tag is handled with the validator.
- Parameters:
tag - the mask tag.- Returns:
true if the mask handles the specified mask tag; otherwise
false.
getTypeByTag
public int getTypeByTag(char tag)
- Gets the type for the specified mask tag. The method should returns
-1
if the tag is not bound with any type.
- Parameters:
tag - the mask tag.- Returns:
- a type.
getBlankChar
public char getBlankChar(char tag)
- Gets the blank character for the specified mask tag. The blank char is used to fill
mask value for the tag.
- Parameters:
tag - the mask tag.- Returns:
- a blank character.
isValidValue
public boolean isValidValue(MaskElement e,
java.lang.String newValue)
- Tests if the specified value is valid for the mask element.
- Parameters:
e - the mask element.newValue - the new value.- Returns:
true if the mask value is valid; otherwise
false.
completeValue
public java.lang.String completeValue(MaskElement e,
java.lang.String newValue)
- Completes the new value for the specified mask element.
- Parameters:
e - the mask element.newValue - the new value.- Returns:
- a new completed value.
|