net.rim.blackberry.api.stringpattern
Class PatternRepository

java.lang.Object
  extended by net.rim.blackberry.api.stringpattern.PatternRepository

public final class PatternRepository
extends Object

Use this class to register ApplicationMenuItems with a Perl-style regular expression or specific String. When a String matching the provided pattern is found, the provided ApplicationMenuItems will appear in the current application menu.

Since:
BlackBerry API 4.3.0

Field Summary
static int PATTERN_TYPE_EXACT_MATCH
          If this pattern type is used, the pattern will match a string if and only if it is an exact match
static int PATTERN_TYPE_REGULAR_EXPRESSION
          If this pattern type is used, the pattern will be treated as a Perl-style regular expression
 
Method Summary
static void addPattern(ApplicationDescriptor application, String pattern, int patternType, ApplicationMenuItem[] menuItems)
          Adds a pattern to the repository
static void removePatterns(ApplicationDescriptor application)
          Removes all patterns in the repository for the current application
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 



Field Detail

PATTERN_TYPE_EXACT_MATCH

public static final int PATTERN_TYPE_EXACT_MATCH
If this pattern type is used, the pattern will match a string if and only if it is an exact match

See Also:
Constant Field Values
Since:
BlackBerry API 4.3.0

PATTERN_TYPE_REGULAR_EXPRESSION

public static final int PATTERN_TYPE_REGULAR_EXPRESSION
If this pattern type is used, the pattern will be treated as a Perl-style regular expression

See Also:
Constant Field Values
Since:
BlackBerry API 4.3.0


Method Detail

addPattern

public static void addPattern(ApplicationDescriptor application,
                              String pattern,
                              int patternType,
                              ApplicationMenuItem[] menuItems)
Adds a pattern to the repository

Parameters:
application - An ApplicationDescriptor that describes the application registering the pattern
pattern - The pattern being registered
patternType - The type of pattern. Specify one of the PatternRepository.PATTERN_TYPE_ constants
menuItems - An array of ApplicationMenuItems to appear when the pattern appears in an ActiveTextField
Throws:
IllegalArgumentException - If pattern is null, zero-length or malformed; or if application is null or does not describe the application calling this method; or if menuItems is null, zero-length or contains objects that are null, or whose toString() methods throw exceptions or return null or return zero-length Strings.
Since:
BlackBerry API 4.3.0

removePatterns

public static void removePatterns(ApplicationDescriptor application)
Removes all patterns in the repository for the current application

Parameters:
application - ApplicationDescriptor describing the application calling this method
Throws:
IllegalArgumentException - If application does not describe the application calling this method or if application is null
Since:
BlackBerry API 4.3.0





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