|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.apache.wicket.util.convert.MaskConverter
T - The converter object typepublic class MaskConverter
A converter that takes a mask into account. It is specifically meant for overrides on individual
components, that provide their own converter by returning it from
Component.getConverter(Class). It uses an instance of MaskFormatter to delegate
the masking and unmasking to.
The following characters can be specified (adopted from the MaskFormatter documentation):
| Character |
Description |
|---|---|
| # | Any valid number, uses Character.isDigit. |
| ' | Escape character, used to escape any of the special formatting characters. |
| U | Any character (Character.isLetter). All lowercase letters are mapped to upper
case. |
| L | Any character (Character.isLetter). All upper case letters are mapped to lower
case. |
| A | Any character or number (Character.isLetter or Character.isDigit) |
| ? | Any character (Character.isLetter). |
| Anything. | |
| H | Any hex character (0-9, a-f or A-F). |
Typically characters correspond to one char, but in certain languages this is not the case. The mask is on a per character basis, and will thus adjust to fit as many chars as are needed.
MaskFormatter,
Serialized Form| Constructor Summary | |
|---|---|
MaskConverter(javax.swing.text.MaskFormatter maskFormatter)
Construct. |
|
MaskConverter(java.lang.String mask)
Construct; converts to Strings. |
|
MaskConverter(java.lang.String mask,
java.lang.Class<?> type)
Construct. |
|
| Method Summary | |
|---|---|
java.lang.Object |
convertToObject(java.lang.String value,
java.util.Locale locale)
Converts a string to an object using MaskFormatter.stringToValue(String). |
java.lang.String |
convertToString(java.lang.Object value,
java.util.Locale locale)
Converts the value to a string using MaskFormatter.valueToString(Object). |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public MaskConverter(javax.swing.text.MaskFormatter maskFormatter)
maskFormatter - The mask formatter to use for masking and unmasking valuespublic MaskConverter(java.lang.String mask)
mask - The mask to use for this converter instanceMaskFormatter
public MaskConverter(java.lang.String mask,
java.lang.Class<?> type)
mask - The mask to use for this converter instancetype - The type to convert string values to.MaskFormatter| Method Detail |
|---|
public java.lang.Object convertToObject(java.lang.String value,
java.util.Locale locale)
MaskFormatter.stringToValue(String).
convertToObject in interface IConvertervalue - The string value to convertlocale - The locale used to convert the value
IConverter.convertToObject(java.lang.String, Locale)
public java.lang.String convertToString(java.lang.Object value,
java.util.Locale locale)
MaskFormatter.valueToString(Object).
convertToString in interface IConvertervalue - The value to convertlocale - The locale used to convert the value
IConverter.convertToString(java.lang.Object, Locale)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||