|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Object | +--net.rim.device.api.ui.text.TextFilter
Defines fundamental functionality for a text filtering object.
A filter has two funtions: first, it can validate whether a character or string is valid, and second it can map characters onto ones more likely to be valid.
| Field Summary | ||
static int |
DEFAULT
Default filter type. |
|
static int |
EMAIL
Email address filter type. |
|
static int |
HEXADECIMAL
Hexadecimal filter type. |
|
static int |
INTEGER
Integer filter type. |
|
static int |
LOWERCASE
Lower case filter type. |
|
static int |
NUMERIC
Numeric filter type. |
|
static int |
PHONE
Phone number filter type. |
|
static int |
UPPERCASE
Upper case filter type. |
|
static int |
URL
URL filter type. |
|
| Constructor Summary | ||
protected |
TextFilter()
Constructs a new TextFilter instance. |
|
| Method Summary | ||
abstract char |
convert(char character,
int status)
Retrieves filtered version of provided character. |
|
static TextFilter |
get(int type)
Retrieve a filter of provided type. |
|
boolean |
validate(AbstractString text)
Determines if provided string contains valid characters. |
|
abstract boolean |
validate(char character)
Validates character for use with this filter. |
|
| Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
| Constructor Detail |
| Method Detail |
public abstract char convert(char character,
int status)
This method may not return a character valid for this filter; however, it may return 0 to indicate that the provided character is not valid.
For example, an UppercaseTextFilter would convert any lower case character to its
upper case equivalent. However, if passed a number it could either leave the number
unchanged to be filtered by validate(char), or convert it to \u0000.
character - Character to convert.status - Indicates how the character was generated: some filters use
this to affect the conversion performed.public static final TextFilter get(int type)
Factory method that produces a text filter of your specified type.
type - Type of filter you want.DEFAULT for type, or an invalid type.public abstract boolean validate(char character)
This only considers if it is in the correct set of characters.
character - Character to test.public boolean validate(AbstractString text)
The default implementation of this method returns true if each
character is valid within the field (determined by invoking
validate(char). This is useful for upper case or lower case
filters, for example, but filters that rely on character position must
override this method.
text - String to test.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
Copyright 1999-2002 Research In Motion Limited. 295 Phillip Street, Waterloo, Ontario, Canada, N2L 3W8. All Rights Reserved.
Copyright 1993-2000 Sun Microsystems, Inc. 901 San Antonio Road, Palo Alto, California, 94303, U.S.A. All Rights Reserved.
Java is a trademark or registered trademark of Sun Microsystems, Inc. in the US and other countries.