Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
爱吃血肠
spring-framework
提交
7d307b38
S
spring-framework
项目概览
爱吃血肠
/
spring-framework
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
S
spring-framework
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
7d307b38
编写于
9月 30, 2014
作者:
J
Juergen Hoeller
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Polishing
上级
fcb9dd19
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
21 addition
and
18 deletion
+21
-18
spring-core/src/main/java/org/springframework/core/ResolvableType.java
...rc/main/java/org/springframework/core/ResolvableType.java
+6
-1
spring-core/src/main/java/org/springframework/util/AntPathMatcher.java
...rc/main/java/org/springframework/util/AntPathMatcher.java
+15
-17
未找到文件。
spring-core/src/main/java/org/springframework/core/ResolvableType.java
浏览文件 @
7d307b38
...
...
@@ -1192,12 +1192,17 @@ public final class ResolvableType implements Serializable {
if
(
type
==
null
)
{
return
NONE
;
}
// Check the cache, we may have a ResolvableType that may have already been resolved
// Purge empty entries on access since we don't have a clean-up thread or the like.
cache
.
purgeUnreferencedEntries
();
// For simple Class references, build the wrapper right away -
// no expensive resolution necessary, so not worth caching...
if
(
type
instanceof
Class
<?>)
{
return
new
ResolvableType
(
type
,
typeProvider
,
variableResolver
,
null
);
}
// Check the cache - we may have a ResolvableType which has been resolved before...
ResolvableType
key
=
new
ResolvableType
(
type
,
typeProvider
,
variableResolver
);
ResolvableType
resolvableType
=
cache
.
get
(
key
);
if
(
resolvableType
==
null
)
{
...
...
spring-core/src/main/java/org/springframework/util/AntPathMatcher.java
浏览文件 @
7d307b38
...
...
@@ -58,7 +58,9 @@ public class AntPathMatcher implements PathMatcher {
private
static
final
Pattern
VARIABLE_PATTERN
=
Pattern
.
compile
(
"\\{[^/]+?\\}"
);
private
String
pathSeparator
=
DEFAULT_PATH_SEPARATOR
;
private
String
pathSeparator
;
private
PathSeparatorPatternCache
pathSeparatorPatternCache
;
private
boolean
trimTokens
=
true
;
...
...
@@ -68,13 +70,13 @@ public class AntPathMatcher implements PathMatcher {
final
Map
<
String
,
AntPathStringMatcher
>
stringMatcherCache
=
new
ConcurrentHashMap
<
String
,
AntPathStringMatcher
>(
256
);
private
PathSeparatorPatternCache
pathSeparatorPatternCache
=
new
PathSeparatorPatternCache
(
DEFAULT_PATH_SEPARATOR
);
/**
* Create a new instance with the {@link #DEFAULT_PATH_SEPARATOR}.
*/
public
AntPathMatcher
()
{
this
.
pathSeparator
=
DEFAULT_PATH_SEPARATOR
;
this
.
pathSeparatorPatternCache
=
new
PathSeparatorPatternCache
(
DEFAULT_PATH_SEPARATOR
);
}
/**
...
...
@@ -580,14 +582,13 @@ public class AntPathMatcher implements PathMatcher {
* {@link #getPatternComparator(String)}.
* <p>In order, the most "generic" pattern is determined by the following:
* <ul>
*
<li>if it's null or a capture all pattern (i.e. it is equal to "/**")</li>
*
<li>if the other pattern is an actual match</li>
*
<li>if it's a catch-all pattern (i.e. it ends with "**"</li>
*
<li>if it's got more "*" than the other pattern</li>
*
<li>if it's got more "{foo}" than the other pattern</li>
*
<li>if it's shorter than the other pattern</li>
* <li>if it's null or a capture all pattern (i.e. it is equal to "/**")</li>
* <li>if the other pattern is an actual match</li>
* <li>if it's a catch-all pattern (i.e. it ends with "**"</li>
* <li>if it's got more "*" than the other pattern</li>
* <li>if it's got more "{foo}" than the other pattern</li>
* <li>if it's shorter than the other pattern</li>
* </ul>
* </p>
*/
protected
static
class
AntPatternComparator
implements
Comparator
<
String
>
{
...
...
@@ -598,15 +599,13 @@ public class AntPathMatcher implements PathMatcher {
}
/**
* Compare two patterns to determine which should match first, i.e. which is the most specific
* regarding the current path.
*
* Compare two patterns to determine which should match first, i.e. which
* is the most specific regarding the current path.
* @return a negative integer, zero, or a positive integer as pattern1 is
* more specific, equally specific, or less specific than pattern2.
*/
@Override
public
int
compare
(
String
pattern1
,
String
pattern2
)
{
PatternInfo
info1
=
new
PatternInfo
(
pattern1
);
PatternInfo
info2
=
new
PatternInfo
(
pattern2
);
...
...
@@ -664,6 +663,7 @@ public class AntPathMatcher implements PathMatcher {
return
0
;
}
/**
* Value class that holds information about the pattern, e.g. number of
* occurrences of "*", "**", and "{" pattern elements.
...
...
@@ -684,7 +684,6 @@ public class AntPathMatcher implements PathMatcher {
private
Integer
length
;
public
PatternInfo
(
String
pattern
)
{
this
.
pattern
=
pattern
;
if
(
this
.
pattern
!=
null
)
{
...
...
@@ -769,8 +768,7 @@ public class AntPathMatcher implements PathMatcher {
private
final
String
endsOnDoubleWildCard
;
private
PathSeparatorPatternCache
(
String
pathSeparator
)
{
public
PathSeparatorPatternCache
(
String
pathSeparator
)
{
this
.
endsOnWildCard
=
pathSeparator
+
"*"
;
this
.
endsOnDoubleWildCard
=
pathSeparator
+
"**"
;
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录