public class UrlStartWithMatcher extends StartWithMatcher
The matching is case sensitive. If one matching string starts with another, and the text string starts with them, then the longer one will be considered to be matched.
匹配时对大小写敏感。如果匹配字符串之间互相饱含,则匹配其中最长的。
attachments, runAutomaton
Constructor and Description |
---|
UrlStartWithMatcher(Map<String,? extends Object> matchingDefinitions)
Create a new instance according to matching strings and their corresponding attachment objects.
根据匹配字符串、匹配字符串所对应的附件对象,创建一个新的实例。 |
UrlStartWithMatcher(Map<String,? extends Object> matchingDefinitions,
boolean moreSpaceForSpeed)
Create a new instance according to matching strings and their corresponding attachment objects.
根据匹配字符串、匹配字符串所对应的附件对象,创建一个新的实例。 |
UrlStartWithMatcher(UrlStartWithMatcher toBeCopied)
Create a copy, the copy will have exactly the same matching
definitions as the original copy.
创建一个副本,这个副本与原先的对象具有完全相同匹配方式。 |
Modifier and Type | Method and Description |
---|---|
Object |
match(String url)
Find out which matching string matches the URL.
|
protected static List<MatchingDefinition> |
normalizeMatchingDefinitions(Map<String,? extends Object> matchingDefinitions,
boolean moreSpaceForSpeed)
Normalize matching definitions according to requirements of
StartWithMatcher .根据 StartWithMatcher 的需要来规范化匹配条件定义。 |
protected static String[] |
splitURL(String url)
将URL拆成两块:反序后的斜线前面的主机、端口和帐号;斜线后面的路径和参数。
比如对于http://www.news.com/read/daily/headline.html,返回的是:
moc.swen.www和read/daily/headline.html两项。
|
copyRunAutomaton, escapeForRegExp, getAllAcceptedStates, getLastAcceptedState, getLastAcceptedState, initialize, match, match, matchAll, matchAll, setAttachmentByExample
public UrlStartWithMatcher(Map<String,? extends Object> matchingDefinitions)
When initializing internal data structure, choose to consume more memory for better matching speed.
在创建内部数据结构的时候,选择占用更多内存,而换取速度上的提升。
matchingDefinitions
- Key是匹配字符串,Value是附件对象。
当进行匹配检查的时候,返回附件对象来标识哪一个匹配字符串被匹配上了。
Key is the matching string, Value is its associated attachment object. When the heading string is matched, the attachment object will be returned as identifier.
public UrlStartWithMatcher(Map<String,? extends Object> matchingDefinitions, boolean moreSpaceForSpeed)
matchingDefinitions
- Key是匹配字符串,Value是附件对象。
当进行匹配检查的时候,返回附件对象来标识哪一个匹配字符串被匹配上了。
Key is the matching string, Value is its associated attachment object. When the heading string is matched, the attachment object will be returned as identifier.
moreSpaceForSpeed
- 是否占用更多内存,而换取速度上的提升。
public UrlStartWithMatcher(UrlStartWithMatcher toBeCopied)
toBeCopied
- 原本。protected static List<MatchingDefinition> normalizeMatchingDefinitions(Map<String,? extends Object> matchingDefinitions, boolean moreSpaceForSpeed)
StartWithMatcher
.StartWithMatcher
的需要来规范化匹配条件定义。matchingDefinitions
- Key是匹配字符串,Value是附件对象。
当进行匹配检查的时候,返回附件对象来标识哪一个匹配字符串被匹配上了。
Key is the matching string, Value is its associated attachment object. When the matching string is matched, the attachment object will be returned as identifier.
moreSpaceForSpeed
- 是否占用更多内存,而换取速度上的提升。
StartWithMatcher
所需的匹配条件定义。
StartWithMatcher
.public Object match(String url)
Matching is case insensitive.
url
- 需要进行匹配判断的URLCopyright © 2014. All Rights Reserved.