| java.lang.Object org.eclipse.jdt.internal.core.search.matching.InternalSearchPattern org.eclipse.jdt.core.search.SearchPattern
All known Subclasses: org.eclipse.jdt.internal.core.search.matching.JavaSearchPattern, org.eclipse.jdt.internal.core.search.matching.OrPattern,
Field Summary | |
final public static int | R_CAMELCASE_MATCH Match rule: The search pattern contains a Camel Case expression.
Examples:
- 'NPE' type string pattern will match
'NullPointerException' and 'NoPermissionException' types,
- 'NuPoEx' type string pattern will only match
'NullPointerException' type.
Can be combined to
SearchPattern.R_PREFIX_MATCH match rule. | final public static int | R_CAMEL_CASE_MATCH Match rule: The search pattern contains a Camel Case expression with
a strict number of parts and preventing automatic prefix matching for the last
part (if it consists of multiple letters).
Examples:
- 'HM' type string pattern will match 'HashMap' and 'HtmlMapper' types,
but not 'HashMapEntry'
- 'HMap' type string pattern will match 'HashMap' type but not 'HtmlMapper'.
This Camel Case match rule does not allow prefix match but accept insensitive
case. | final public static int | R_CASE_SENSITIVE Match rule: The search pattern matches the search result only if cases are the same.
Can be combined to previous rules, e.g. | final public static int | R_EQUIVALENT_MATCH Match rule: The search pattern matches search results as raw/parameterized types/methods with equivalent type parameters.
This mode has no effect on other java elements search.
Type search example:
- pattern:
List<Exception>
- match:
List<? extends Throwable>
List<? super RuntimeException>
List<?>
Method search example:
- declaration:
<T>foo(T t)
- pattern:
<Exception>foo(new Exception())
- match:
<? extends Throwable>foo(new Exception())
<? super RuntimeException>foo(new Exception())
foo(new Exception())
Can be combined to all other match rules, e.g. | final public static int | R_ERASURE_MATCH Match rule: The search pattern matches search results as raw/parameterized types/methods with same erasure.
This mode has no effect on other java elements search.
Type search example:
- pattern:
List<Exception>
- match:
List<Object>
Method search example:
- declaration:
<T>foo(T t)
- pattern:
<Exception>foo(new Exception())
- match:
<Object>foo(new Object())
Can be combined to all other match rules, e.g. | final public static int | R_EXACT_MATCH Match rule: The search pattern matches exactly the search result,
that is, the source of the search result equals the search pattern. | final public static int | R_FULL_MATCH Match rule: The search pattern matches exactly the search result,
that is, the source of the search result equals the search pattern. | final public static int | R_PATTERN_MATCH Match rule: The search pattern contains one or more wild cards ('*' or '?'). | final public static int | R_PREFIX_MATCH Match rule: The search pattern is a prefix of the search result. | final public static int | R_REGEXP_MATCH Match rule: The search pattern contains a regular expression. |
Constructor Summary | |
public | SearchPattern(int matchRule) Creates a search pattern with the rule to apply for matching index keys. |
Method Summary | |
final public static boolean | camelCaseMatch(String pattern, String name) Answers true if the pattern matches the given name using CamelCase rules, or
false otherwise. | final public static boolean | camelCaseMatch(String pattern, String name, boolean prefixMatch) Answers true if the pattern matches the given name using CamelCase rules, or
false otherwise. | final public static boolean | camelCaseMatch(String pattern, int patternStart, int patternEnd, String name, int nameStart, int nameEnd) Answers true if a sub-pattern matches the sub-part of the given name using
CamelCase rules, or false otherwise. | final public static boolean | camelCaseMatch(String pattern, int patternStart, int patternEnd, String name, int nameStart, int nameEnd, boolean prefixMatch) Answers true if a sub-pattern matches the sub-part of the given name using
CamelCase rules, or false otherwise. | public static SearchPattern | createAndPattern(SearchPattern leftPattern, SearchPattern rightPattern) Returns a search pattern that combines the given two patterns into an
"and" pattern. | public static SearchPattern | createOrPattern(SearchPattern leftPattern, SearchPattern rightPattern) Returns a search pattern that combines the given two patterns into an
"or" pattern. | public static SearchPattern | createPattern(String stringPattern, int searchFor, int limitTo, int matchRule) Returns a search pattern based on a given string pattern. | public static SearchPattern | createPattern(IJavaElement element, int limitTo) Returns a search pattern based on a given Java element. | public static SearchPattern | createPattern(IJavaElement element, int limitTo, int matchRule) Returns a search pattern based on a given Java element. | public void | decodeIndexKey(char[] key) Decode the given index key in this pattern. | abstract public SearchPattern | getBlankPattern() Returns a blank pattern that can be used as a record to decode an index key. | public char[][] | getIndexCategories() Returns an array of index categories to consider for this index query. | public char[] | getIndexKey() Returns a key to find in relevant index categories, if null then all index entries are matched.
The key will be matched according to some match rule. | final public int | getMatchRule() Returns the rule to apply for matching index keys. | public boolean | matchesDecodedKey(SearchPattern decodedPattern) Returns whether this pattern matches the given pattern (representing a decoded index key). | public boolean | matchesName(char[] pattern, char[] name) Returns whether the given name matches the given pattern. | public String | toString() | static int | updateMatchRule(int matchRule) Update deprecated flags if necessary in the given match rule. | public static int | validateMatchRule(String stringPattern, int matchRule) Validate compatibility between given string pattern and match rule.
Returned match rule is modified, when following combinations are observed in the given parameters:
Rejected (i.e. |
R_CAMELCASE_MATCH | final public static int R_CAMELCASE_MATCH(Code) | | Match rule: The search pattern contains a Camel Case expression.
Examples:
- 'NPE' type string pattern will match
'NullPointerException' and 'NoPermissionException' types,
- 'NuPoEx' type string pattern will only match
'NullPointerException' type.
Can be combined to
SearchPattern.R_PREFIX_MATCH match rule. For example,
when prefix match rule is combined with Camel Case match rule,
'nPE' pattern will match 'nPException'.
Match rule
SearchPattern.R_PATTERN_MATCH may also be combined but both rules
will not be used simultaneously as they are mutually exclusive.
Used match rule depends on whether string pattern contains specific pattern
characters (e.g. '*' or '?') or not. If it does, then only Pattern match rule
will be used, otherwise only Camel Case match will be used.
For example, with 'NPE' string pattern, search will only use
Camel Case match rule, but with 'N*P*E*' string pattern, it will
use only Pattern match rule.
See Also: SearchPattern.camelCaseMatch(String,String) See Also: for a detailed explanation of Camel See Also: Case matching. since: 3.2SearchPattern.R_CAMEL_CASE_MATCHSearchPattern.R_PREFIX_MATCH |
R_CAMEL_CASE_MATCH | final public static int R_CAMEL_CASE_MATCH(Code) | | Match rule: The search pattern contains a Camel Case expression with
a strict number of parts and preventing automatic prefix matching for the last
part (if it consists of multiple letters).
Examples:
- 'HM' type string pattern will match 'HashMap' and 'HtmlMapper' types,
but not 'HashMapEntry'
- 'HMap' type string pattern will match 'HashMap' type but not 'HtmlMapper'.
This Camel Case match rule does not allow prefix match but accept insensitive
case. For instance, 'HashMap' or 'HASHMAP' patterns using this Camel Case
rule will match both 'HashMap' but not 'HashMapEntry'.
This rule still can be combined to prefix match to accept prefix matches
('HashMap' pattern matching 'HashMapEntry' name). It can also be combined
to case sensitive match to reject case insensitive matches ('HAMA' pattern
will not match 'HashMap' name).
If
SearchPattern.R_PATTERN_MATCH rule is also combined, then the real used
match rule will depend on whether string pattern contains specific pattern
characters (e.g. '*' or '?') or not. If it does, then only Pattern match rule will
be used, otherwise only Camel Case match will be used.
For example, with 'NPE' string pattern, search will only use
Camel Case match rule, but with 'N*P*E*' string pattern, it will
use only Pattern match rule.
See Also: CharOperation.camelCaseMatch(char[]char[]boolean) See Also: for a detailed See Also: explanation of Camel Case matching. See Also: since: 3.4
|
R_EQUIVALENT_MATCH | final public static int R_EQUIVALENT_MATCH(Code) | | Match rule: The search pattern matches search results as raw/parameterized types/methods with equivalent type parameters.
This mode has no effect on other java elements search.
Type search example:
- pattern:
List<Exception>
- match:
List<? extends Throwable>
List<? super RuntimeException>
List<?>
Method search example:
- declaration:
<T>foo(T t)
- pattern:
<Exception>foo(new Exception())
- match:
<? extends Throwable>foo(new Exception())
<? super RuntimeException>foo(new Exception())
foo(new Exception())
Can be combined to all other match rules, e.g.
SearchPattern.R_CASE_SENSITIVE |
SearchPattern.R_EQUIVALENT_MATCH This rule is not activated by default, so raw types or equivalent parameterized types will not be found
for pattern List<String>,
This mode is overridden by
SearchPattern.R_ERASURE_MATCH as erasure matches obviously include equivalent ones.
That means that pattern with rule set to
SearchPattern.R_EQUIVALENT_MATCH |
SearchPattern.R_ERASURE_MATCH will return same results than rule only set with
SearchPattern.R_ERASURE_MATCH .
since: 3.1 |
R_ERASURE_MATCH | final public static int R_ERASURE_MATCH(Code) | | Match rule: The search pattern matches search results as raw/parameterized types/methods with same erasure.
This mode has no effect on other java elements search.
Type search example:
- pattern:
List<Exception>
- match:
List<Object>
Method search example:
- declaration:
<T>foo(T t)
- pattern:
<Exception>foo(new Exception())
- match:
<Object>foo(new Object())
Can be combined to all other match rules, e.g.
SearchPattern.R_CASE_SENSITIVE |
SearchPattern.R_ERASURE_MATCH This rule is not activated by default, so raw types or parameterized types with same erasure will not be found
for pattern List<String>,
Note that with this pattern, the match selection will be only on the erasure even for parameterized types.
since: 3.1 |
R_EXACT_MATCH | final public static int R_EXACT_MATCH(Code) | | Match rule: The search pattern matches exactly the search result,
that is, the source of the search result equals the search pattern.
|
R_FULL_MATCH | final public static int R_FULL_MATCH(Code) | | Match rule: The search pattern matches exactly the search result,
that is, the source of the search result equals the search pattern.
since: 3.1 |
R_PATTERN_MATCH | final public static int R_PATTERN_MATCH(Code) | | Match rule: The search pattern contains one or more wild cards ('*' or '?').
A '*' wild-card can replace 0 or more characters in the search result.
A '?' wild-card replaces exactly 1 character in the search result.
|
R_PREFIX_MATCH | final public static int R_PREFIX_MATCH(Code) | | Match rule: The search pattern is a prefix of the search result.
|
R_REGEXP_MATCH | final public static int R_REGEXP_MATCH(Code) | | Match rule: The search pattern contains a regular expression.
|
camelCaseMatch | final public static boolean camelCaseMatch(String pattern, String name)(Code) | | Answers true if the pattern matches the given name using CamelCase rules, or
false otherwise. char[] CamelCase matching does NOT accept explicit wild-cards
'*' and '?' and is inherently case sensitive.
CamelCase denotes the convention of writing compound names without spaces,
and capitalizing every term. This function recognizes both upper and lower
CamelCase, depending whether the leading character is capitalized or not.
The leading part of an upper CamelCase pattern is assumed to contain a
sequence of capitals which are appearing in the matching name; e.g. 'NPE' will
match 'NullPointerException', but not 'NewPerfData'. A lower CamelCase pattern
uses a lowercase first character. In Java, type names follow the upper
CamelCase convention, whereas method or field names follow the lower
CamelCase convention.
The pattern may contain lowercase characters, which will be matched in a case
sensitive way. These characters must appear in sequence in the name.
For instance, 'NPExcep' will match 'NullPointerException', but not
'NullPointerExCEPTION' or 'NuPoEx' will match 'NullPointerException', but not
'NoPointerException'.
Digit characters are treated in a special way. They can be used in the pattern
but are not always considered as leading character. For instance, both
'UTF16DSS' and 'UTFDSS' patterns will match 'UTF16DocumentScannerSupport'.
This method allows prefix match in Camel Case (see
SearchPattern.camelCaseMatch(String,String,boolean) ).
Examples:
- pattern = "NPE"
name = NullPointerException / NoPermissionException
result => true
- pattern = "NuPoEx"
name = NullPointerException
result => true
- pattern = "npe"
name = NullPointerException
result => false
- pattern = "IPL3"
name = "IPerspectiveListener3"
result => true
- pattern = "HM"
name = "HashMapEntry"
result => true
- pattern = "HMap"
name = "HatMapper"
result => true
See Also: SearchPattern.camelCaseMatch(String,int,int,String,int,int,boolean) See Also: for algorithm See Also: implementation Parameters: pattern - the given pattern Parameters: name - the given name true if the pattern matches the given name, false otherwise since: 3.2 |
camelCaseMatch | final public static boolean camelCaseMatch(String pattern, String name, boolean prefixMatch)(Code) | | Answers true if the pattern matches the given name using CamelCase rules, or
false otherwise. char[] CamelCase matching does NOT accept explicit wild-cards
'*' and '?' and is inherently case sensitive.
CamelCase denotes the convention of writing compound names without spaces,
and capitalizing every term. This function recognizes both upper and lower
CamelCase, depending whether the leading character is capitalized or not.
The leading part of an upper CamelCase pattern is assumed to contain a
sequence of capitals which are appearing in the matching name; e.g. 'NPE' will
match 'NullPointerException', but not 'NewPerfData'. A lower CamelCase pattern
uses a lowercase first character. In Java, type names follow the upper
CamelCase convention, whereas method or field names follow the lower
CamelCase convention.
The pattern may contain lowercase characters, which will be matched in a case
sensitive way. These characters must appear in sequence in the name.
For instance, 'NPExcep' will match 'NullPointerException', but not
'NullPointerExCEPTION' or 'NuPoEx' will match 'NullPointerException', but not
'NoPointerException'.
Digit characters are treated in a special way. They can be used in the pattern
but are not always considered as leading character. For instance, both
'UTF16DSS' and 'UTFDSS' patterns will match 'UTF16DocumentScannerSupport'.
CamelCase may or may not match prefixes depending on the given parameter.
When the prefix match parameter is true , the given pattern can
match only a prefix of the given name. For instance, 'HM' , 'HaMa' and 'HMap'
patterns will all match 'HashMap', 'HatMapper' and 'HashMapEntry'.
Reversely, if the prefix match parameter is false , then pattern
and name must have exactly the same number of parts, and their last
parts must be identical if they contain lowercase characters.
For instance, 'HMap' and 'HaMap' patterns will match 'HashMap' but neither
'HashMapEntry' nor 'HatMapper'. Note that when the last part does not contain
lowercase characters, then the name may end with lowercase characters.
So, 'HM' pattern will match both 'HashMap' and 'HatMapper' but will not
match 'HashMapEntry'.
Examples:
- pattern = "NPE"
name = NullPointerException / NoPermissionException
result => true
- pattern = "NuPoEx"
name = NullPointerException
result => true
- pattern = "npe"
name = NullPointerException
result => false
- pattern = "IPL3"
name = "IPerspectiveListener3"
result => true
- pattern = "HM"
name = "HashMapEntry"
result => (prefixMatch == true)
- pattern = "HMap"
name = "HatMapper"
result => (prefixMatch == true)
See Also: SearchPattern.camelCaseMatch(String,int,int,String,int,int,boolean) See Also: for algorithm See Also: implementation Parameters: pattern - the given pattern Parameters: name - the given name Parameters: prefixMatch - flag telling whether the pattern can match name prefix or not.- For example, when it's
true : - HM type string pattern will matchHashMap and HtmlMapper types,but not HashMapEntry - HMap type string pattern will matchHashMap type but not HtmlMapper . - and, when it's
false : - HM type string pattern will match both HashMap and HtmlMapper and HashMapEntry - HMap type string pattern will match bothHashMap and HtmlMapper types. true if the pattern matches the given name, false otherwise since: 3.4 |
camelCaseMatch | final public static boolean camelCaseMatch(String pattern, int patternStart, int patternEnd, String name, int nameStart, int nameEnd)(Code) | | Answers true if a sub-pattern matches the sub-part of the given name using
CamelCase rules, or false otherwise. char[] CamelCase matching does NOT
accept explicit wild-cards '*' and '?' and is inherently case sensitive.
Can match only subset of name/pattern, considering end positions as non-inclusive.
The sub-pattern is defined by the patternStart and patternEnd positions.
CamelCase denotes the convention of writing compound names without spaces,
and capitalizing every term. This function recognizes both upper and lower
CamelCase, depending whether the leading character is capitalized or not.
The leading part of an upper CamelCase pattern is assumed to contain a
sequence of capitals which are appearing in the matching name; e.g. 'NPE' will
match 'NullPointerException', but not 'NewPerfData'. A lower CamelCase pattern
uses a lowercase first character. In Java, type names follow the upper
CamelCase convention, whereas method or field names follow the lower
CamelCase convention.
The pattern may contain lowercase characters, which will be matched in a case
sensitive way. These characters must appear in sequence in the name.
For instance, 'NPExcep' will match 'NullPointerException', but not
'NullPointerExCEPTION' or 'NuPoEx' will match 'NullPointerException', but not
'NoPointerException'.
Digit characters are treated in a special way. They can be used in the pattern
but are not always considered as leading character. For instance, both
'UTF16DSS' and 'UTFDSS' patterns will match 'UTF16DocumentScannerSupport'.
Digit characters are treated in a special way. They can be used in the pattern
but are not always considered as leading character. For instance, both
'UTF16DSS' and 'UTFDSS' patterns will match 'UTF16DocumentScannerSupport'.
This method allows prefix match in Camel Case (see
SearchPattern.camelCaseMatch(String,int,int,String,int,int,boolean) ).
Examples:
- pattern = "NPE"
patternStart = 0
patternEnd = 3
name = NullPointerException
nameStart = 0
nameEnd = 20
result => true
- pattern = "NPE"
patternStart = 0
patternEnd = 3
name = NoPermissionException
nameStart = 0
nameEnd = 21
result => true
- pattern = "NuPoEx"
patternStart = 0
patternEnd = 6
name = NullPointerException
nameStart = 0
nameEnd = 20
result => true
- pattern = "NuPoEx"
patternStart = 0
patternEnd = 6
name = NoPermissionException
nameStart = 0
nameEnd = 21
result => false
- pattern = "npe"
patternStart = 0
patternEnd = 3
name = NullPointerException
nameStart = 0
nameEnd = 20
result => false
- pattern = "IPL3"
patternStart = 0
patternEnd = 3
name = "IPerspectiveListener3"
nameStart = 0
nameEnd = 21
result => true
- pattern = "HM"
patternStart = 0
patternEnd = 2
name = "HashMapEntry"
nameStart = 0
nameEnd = 12
result => true
- pattern = "HMap"
patternStart = 0
patternEnd = 4
name = "HatMapper"
nameStart = 0
nameEnd = 9
result => true
Parameters: pattern - the given pattern Parameters: patternStart - the start index of the pattern, inclusive Parameters: patternEnd - the end index of the pattern, exclusive Parameters: name - the given name Parameters: nameStart - the start index of the name, inclusive Parameters: nameEnd - the end index of the name, exclusive true if a sub-pattern matches the sub-part of the given name, false otherwise since: 3.2 |
camelCaseMatch | final public static boolean camelCaseMatch(String pattern, int patternStart, int patternEnd, String name, int nameStart, int nameEnd, boolean prefixMatch)(Code) | | Answers true if a sub-pattern matches the sub-part of the given name using
CamelCase rules, or false otherwise. char[] CamelCase matching does NOT
accept explicit wild-cards '*' and '?' and is inherently case sensitive.
Can match only subset of name/pattern, considering end positions as
non-inclusive. The sub-pattern is defined by the patternStart and patternEnd
positions.
CamelCase denotes the convention of writing compound names without spaces,
and capitalizing every term. This function recognizes both upper and lower
CamelCase, depending whether the leading character is capitalized or not.
The leading part of an upper CamelCase pattern is assumed to contain
a sequence of capitals which are appearing in the matching name; e.g. 'NPE' will
match 'NullPointerException', but not 'NewPerfData'. A lower CamelCase pattern
uses a lowercase first character. In Java, type names follow the upper
CamelCase convention, whereas method or field names follow the lower
CamelCase convention.
The pattern may contain lowercase characters, which will be matched in a case
sensitive way. These characters must appear in sequence in the name.
For instance, 'NPExcep' will match 'NullPointerException', but not
'NullPointerExCEPTION' or 'NuPoEx' will match 'NullPointerException', but not
'NoPointerException'.
Digit characters are treated in a special way. They can be used in the pattern
but are not always considered as leading character. For instance, both
'UTF16DSS' and 'UTFDSS' patterns will match 'UTF16DocumentScannerSupport'.
CamelCase may or may not match prefixes depending on the given parameter.
When the prefix match parameter is true , the given pattern can
match only a prefix of the given name. For instance, 'HM' , 'HaMa' and 'HMap'
patterns will all match 'HashMap', 'HatMapper' and 'HashMapEntry'.
Reversely, if the prefix match parameter is false , then pattern
and name must have exactly the same number of parts, and their last
parts must be identical if they contain lowercase characters.
For instance, 'HMap' and 'HaMap' patterns will match 'HashMap' but neither
'HashMapEntry' nor 'HatMapper'. Note that when the last part does not contain
lowercase characters, then the name may end with lowercase characters.
So, 'HM' pattern will match both 'HashMap' and 'HatMapper' but will not
match 'HashMapEntry'.
Examples:
- pattern = "NPE"
patternStart = 0
patternEnd = 3
name = NullPointerException
nameStart = 0
nameEnd = 20
result => true
- pattern = "NPE"
patternStart = 0
patternEnd = 3
name = NoPermissionException
nameStart = 0
nameEnd = 21
result => true
- pattern = "NuPoEx"
patternStart = 0
patternEnd = 6
name = NullPointerException
nameStart = 0
nameEnd = 20
result => true
- pattern = "NuPoEx"
patternStart = 0
patternEnd = 6
name = NoPermissionException
nameStart = 0
nameEnd = 21
result => false
- pattern = "npe"
patternStart = 0
patternEnd = 3
name = NullPointerException
nameStart = 0
nameEnd = 20
result => false
- pattern = "IPL3"
patternStart = 0
patternEnd = 3
name = "IPerspectiveListener3"
nameStart = 0
nameEnd = 21
result => true
- pattern = "HM"
patternStart = 0
patternEnd = 2
name = "HashMapEntry"
nameStart = 0
nameEnd = 12
result => (prefixMatch == true)
- pattern = "HMap"
patternStart = 0
patternEnd = 4
name = "HatMapper"
nameStart = 0
nameEnd = 9
result => (prefixMatch == true)
See Also: CharOperation.camelCaseMatch(char[]intintchar[]intintboolean) See Also: from which algorithm implementation has been entirely copied. Parameters: pattern - the given pattern Parameters: patternStart - the start index of the pattern, inclusive Parameters: patternEnd - the end index of the pattern, exclusive Parameters: name - the given name Parameters: nameStart - the start index of the name, inclusive Parameters: nameEnd - the end index of the name, exclusive Parameters: prefixMatch - flag telling whether the pattern can match name prefix or not.- For example, when it's
true : - HM type string pattern will matchHashMap and HtmlMapper types,but not HashMapEntry - HMap type string pattern will matchHashMap type but not HtmlMapper . - and, when it's
false : - HM type string pattern will match both HashMap and HtmlMapper and HashMapEntry - HMap type string pattern will match bothHashMap and HtmlMapper types. true if a sub-pattern matches the sub-part of the given name, false otherwise since: 3.4 |
createAndPattern | public static SearchPattern createAndPattern(SearchPattern leftPattern, SearchPattern rightPattern)(Code) | | Returns a search pattern that combines the given two patterns into an
"and" pattern. The search result will match both the left pattern and
the right pattern.
Parameters: leftPattern - the left pattern Parameters: rightPattern - the right pattern an "and" pattern |
createOrPattern | public static SearchPattern createOrPattern(SearchPattern leftPattern, SearchPattern rightPattern)(Code) | | Returns a search pattern that combines the given two patterns into an
"or" pattern. The search result will match either the left pattern or the
right pattern.
Parameters: leftPattern - the left pattern Parameters: rightPattern - the right pattern an "or" pattern |
createPattern | public static SearchPattern createPattern(String stringPattern, int searchFor, int limitTo, int matchRule)(Code) | | Returns a search pattern based on a given string pattern. The string patterns support '*' wild-cards.
The remaining parameters are used to narrow down the type of expected results.
Examples:
- search for case insensitive references to
Object :
createSearchPattern("Object", TYPE, REFERENCES, false);
- search for case sensitive references to exact
Object() constructor:
createSearchPattern("java.lang.Object()", CONSTRUCTOR, REFERENCES, true);
- search for implementers of
java.lang.Runnable :
createSearchPattern("java.lang.Runnable", TYPE, IMPLEMENTORS, true);
Parameters: stringPattern - the given pattern Parameters: searchFor - determines the nature of the searched elements Parameters: limitTo - determines the nature of the expected matches Parameters: matchRule - one of SearchPattern.R_EXACT_MATCH, SearchPattern.R_PREFIX_MATCH,SearchPattern.R_PATTERN_MATCH, SearchPattern.R_REGEXP_MATCH combined withone of following values: SearchPattern.R_CASE_SENSITIVE, SearchPattern.R_ERASURE_MATCH,SearchPattern.R_EQUIVALENT_MATCH or SearchPattern.R_CAMEL_CASE_MATCH.e.g. SearchPattern.R_EXACT_MATCH | SearchPattern.R_CASE_SENSITIVE if an exactand case sensitive match is requested, SearchPattern.R_PREFIX_MATCH if a prefixnon case sensitive match is requested or SearchPattern.R_EXACT_MATCH | SearchPattern.R_ERASURE_MATCHif a non case sensitive and erasure match is requested. Note that SearchPattern.R_ERASURE_MATCH or SearchPattern.R_EQUIVALENT_MATCH have no effecton non-generic types/methods search. Note also that default behavior for generic types/methods search is to find exact matches. a search pattern on the given string pattern, or null if the string pattern is ill-formed |
createPattern | public static SearchPattern createPattern(IJavaElement element, int limitTo)(Code) | | Returns a search pattern based on a given Java element.
The pattern is used to trigger the appropriate search.
Note that for generic searches, the returned pattern consider
SearchPattern.R_ERASURE_MATCH matches.
If other kind of generic matches (i.e.
SearchPattern.R_EXACT_MATCH or
SearchPattern.R_EQUIVALENT_MATCH )
are expected,
SearchPattern.createPattern(IJavaElement,int,int) method need to be used instead with
the explicit match rule specified.
The pattern can be parameterized as follows:
Parameters: element - the Java element the search pattern is based on Parameters: limitTo - determines the nature of the expected matches- IJavaSearchConstants.DECLARATIONS: will search declarations matchingwith the corresponding element. In case the element is a method, declarations of matchingmethods in sub-types will also be found, allowing to find declarations of abstract methods, etc.Some additional flags may be specified while searching declaration:Note that these two flags may be combined and both declaring and return types can be ignoredduring the search. Then, using same example, search for
method declarationwith these 2 flags will return 3 matches: in A, in B and in C - IJavaSearchConstants.REFERENCES: will search references to the given element.
- IJavaSearchConstants.ALL_OCCURRENCES: will search for either declarations orreferences as specified above.
- IJavaSearchConstants.IMPLEMENTORS: for types, will find all typeswhich directly implement/extend a given interface.
a search pattern for a Java element or null if the given element is ill-formed |
createPattern | public static SearchPattern createPattern(IJavaElement element, int limitTo, int matchRule)(Code) | | Returns a search pattern based on a given Java element.
The pattern is used to trigger the appropriate search, and can be parameterized as follows:
Parameters: element - the Java element the search pattern is based on Parameters: limitTo - determines the nature of the expected matches- IJavaSearchConstants.DECLARATIONS: will search declarations matchingwith the corresponding element. In case the element is a method, declarations of matchingmethods in sub-types will also be found, allowing to find declarations of abstract methods, etc.Some additional flags may be specified while searching declaration:Note that these two flags may be combined and both declaring and return types can be ignoredduring the search. Then, using same example, search for
method declarationwith these 2 flags will return 3 matches: in A, in B and in C - IJavaSearchConstants.REFERENCES: will search references to the given element.
- IJavaSearchConstants.ALL_OCCURRENCES: will search for either declarations orreferences as specified above.
- IJavaSearchConstants.IMPLEMENTORS: for types, will find all typeswhich directly implement/extend a given interface.
Parameters: matchRule - one of SearchPattern.R_EXACT_MATCH, SearchPattern.R_PREFIX_MATCH,SearchPattern.R_PATTERN_MATCH, SearchPattern.R_REGEXP_MATCH combined withone of following values: SearchPattern.R_CASE_SENSITIVE, SearchPattern.R_ERASURE_MATCH,SearchPattern.R_EQUIVALENT_MATCH or SearchPattern.R_CAMEL_CASE_MATCH.e.g. SearchPattern.R_EXACT_MATCH | SearchPattern.R_CASE_SENSITIVE if an exactand case sensitive match is requested, SearchPattern.R_PREFIX_MATCH if a prefixnon case sensitive match is requested or SearchPattern.R_EXACT_MATCH | SearchPattern.R_ERASURE_MATCHif a non case sensitive and erasure match is requested. Note that SearchPattern.R_ERASURE_MATCH or SearchPattern.R_EQUIVALENT_MATCH have no effecton non-generic types/methods search. Note also that default behavior for generic types/methods search is to find exact matches. a search pattern for a Java element or null if the given element is ill-formed since: 3.1 |
decodeIndexKey | public void decodeIndexKey(char[] key)(Code) | | Decode the given index key in this pattern. The decoded index key is used by
SearchPattern.matchesDecodedKey(SearchPattern) to find out if the corresponding index entry
should be considered.
This method should be re-implemented in subclasses that need to decode an index key.
Parameters: key - the given index key |
getBlankPattern | abstract public SearchPattern getBlankPattern()(Code) | | Returns a blank pattern that can be used as a record to decode an index key.
Implementors of this method should return a new search pattern that is going to be used
to decode index keys.
a new blank pattern See Also: SearchPattern.decodeIndexKey(char[]) |
getIndexCategories | public char[][] getIndexCategories()(Code) | | Returns an array of index categories to consider for this index query.
These potential matches will be further narrowed by the match locator, but precise
match locating can be expensive, and index query should be as accurate as possible
so as to eliminate obvious false hits.
This method should be re-implemented in subclasses that need to narrow down the
index query.
an array of index categories |
getIndexKey | public char[] getIndexKey()(Code) | | Returns a key to find in relevant index categories, if null then all index entries are matched.
The key will be matched according to some match rule. These potential matches
will be further narrowed by the match locator, but precise match locating can be expensive,
and index query should be as accurate as possible so as to eliminate obvious false hits.
This method should be re-implemented in subclasses that need to narrow down the
index query.
an index key from this pattern, or null if all index entries are matched. |
getMatchRule | final public int getMatchRule()(Code) | | Returns the rule to apply for matching index keys. Can be exact match, prefix match, pattern match or regexp match.
Rule can also be combined with a case sensitivity flag.
one of R_EXACT_MATCH, R_PREFIX_MATCH, R_PATTERN_MATCH, R_REGEXP_MATCH combined with R_CASE_SENSITIVE,e.g. R_EXACT_MATCH | R_CASE_SENSITIVE if an exact and case sensitive match is requested, or R_PREFIX_MATCH if a prefix non case sensitive match is requested.[TODO (frederic) I hope R_ERASURE_MATCH doesn't need to be on this list. Because it would be a breaking API change.] |
matchesDecodedKey | public boolean matchesDecodedKey(SearchPattern decodedPattern)(Code) | | Returns whether this pattern matches the given pattern (representing a decoded index key).
This method should be re-implemented in subclasses that need to narrow down the
index query.
Parameters: decodedPattern - a pattern representing a decoded index key whether this pattern matches the given pattern |
matchesName | public boolean matchesName(char[] pattern, char[] name)(Code) | | Returns whether the given name matches the given pattern.
This method should be re-implemented in subclasses that need to define how
a name matches a pattern.
Parameters: pattern - the given pattern, or null to represent "*" Parameters: name - the given name whether the given name matches the given pattern |
updateMatchRule | static int updateMatchRule(int matchRule)(Code) | | Update deprecated flags if necessary in the given match rule.
Parameters: matchRule - The match rule to update The updated match rule with the updated flags |
validateMatchRule | public static int validateMatchRule(String stringPattern, int matchRule)(Code) | | Validate compatibility between given string pattern and match rule.
Returned match rule is modified, when following combinations are observed in the given parameters:
Rejected (i.e. returned match rule -1) combinations are:
Parameters: stringPattern - The string pattern Parameters: matchRule - The match rule Optimized valid match rule or -1 if an incompatibility was detected. since: 3.2 |
|
|