net.rim.device.api.ui.text
Class EmailAddressTextFilter

java.lang.Object
  extended by net.rim.device.api.ui.text.TextFilter
      extended by net.rim.device.api.ui.text.EmailAddressTextFilter

public class EmailAddressTextFilter
extends TextFilter

Filters out characters not usable in URL text strings.

This filter accepts all characters except control characters, delimiters, and unwise characters (see RFC 2396). Note, however, it does allow spaces. This is because some corporate email systems use email address in the form "firstname lastname".


Field Summary
 
Fields inherited from class net.rim.device.api.ui.text.TextFilter
ADN_SIM_PHONE, DEFAULT, DEFAULT_SMART_PHONE, EMAIL, FDN_SIM_PHONE, FILENAME, HEXADECIMAL, INTEGER, IP, LOWERCASE, NUMERIC, PHONE, PIN_ADDRESS, REAL_NUMERIC, SIM_PHONE, SMS_PHONE, STYLE_SHIFT, UPPERCASE, URL, VOICEMAIL_PHONE
 
Constructor Summary
EmailAddressTextFilter()
          Constructs a new EmailAddressTextFilter instance.
 
Method Summary
 char convert(char character, int status)
          Retrieves filtered version of provided character.
 boolean validate(char character)
          Determines if character is a valid email address character.
 boolean validate(AbstractString text)
          Determines if provided string contains valid email address characters.
 
Methods inherited from class net.rim.device.api.ui.text.TextFilter
convert, get, validate
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 



Constructor Detail

EmailAddressTextFilter

public EmailAddressTextFilter()
Constructs a new EmailAddressTextFilter instance.



Method Detail

convert

public char convert(char character,
                    int status)
Retrieves filtered version of provided character.

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 EmailAddressTextFilter.validate(char), or convert it to \u0000.

Specified by:
convert in class TextFilter
Parameters:
character - Character to convert.
status - Indicates how the character was generated: some filters use this to affect the conversion performed.
Returns:
Filtered version of provided character.

validate

public boolean validate(char character)
Determines if character is a valid email address character.

Specified by:
validate in class TextFilter
Parameters:
character - Character to test.
Returns:
False if passed a control character, or any of the following characters, not including the enclosing parens or delimiting commas: (<,>,",{,},|,\\,^,[,],`).

validate

public boolean validate(AbstractString text)
Determines if provided string contains valid email address characters.

This method checks each character in your provided string with EmailAddressTextFilter.validate(char) for validity. It does no checking that your string is a well formed email address.

Overrides:
validate in class TextFilter
Parameters:
text - String to check.
Returns:
True if each character in the string passes a validity check, otherwise, false.





Copyright 1999-2011 Research In Motion Limited. 295 Phillip Street, Waterloo, Ontario, Canada, N2L 3W8. All Rights Reserved.
Java is a trademark of Oracle America Inc. in the US and other countries.
Legal