Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
爱吃血肠
spring-framework
提交
bb28d198
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 搜索 >>
提交
bb28d198
编写于
1月 26, 2014
作者:
J
Juergen Hoeller
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Polishing
上级
e0fd54b8
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
21 addition
and
15 deletion
+21
-15
spring-core/src/main/java/org/springframework/core/env/CommandLinePropertySource.java
...g/springframework/core/env/CommandLinePropertySource.java
+11
-7
spring-core/src/main/java/org/springframework/core/env/JOptCommandLinePropertySource.java
...ringframework/core/env/JOptCommandLinePropertySource.java
+4
-3
spring-webmvc/src/main/java/org/springframework/web/servlet/FlashMap.java
...c/main/java/org/springframework/web/servlet/FlashMap.java
+6
-5
未找到文件。
spring-core/src/main/java/org/springframework/core/env/CommandLinePropertySource.java
浏览文件 @
bb28d198
/*
* Copyright 2002-201
3
the original author or authors.
* Copyright 2002-201
4
the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
...
...
@@ -193,27 +193,30 @@ public abstract class CommandLinePropertySource<T> extends EnumerablePropertySou
/** The default name of the property representing non-option arguments: {@value} */
public
static
final
String
DEFAULT_NON_OPTION_ARGS_PROPERTY_NAME
=
"nonOptionArgs"
;
private
String
nonOptionArgsPropertyName
=
DEFAULT_NON_OPTION_ARGS_PROPERTY_NAME
;
/**
* Create a new {@code CommandLinePropertySource} having the default name
{@value
* #COMMAND_LINE_PROPERTY_SOURCE_NAME} and backed by the given source object.
* Create a new {@code CommandLinePropertySource} having the default name
*
{@value
#COMMAND_LINE_PROPERTY_SOURCE_NAME} and backed by the given source object.
*/
public
CommandLinePropertySource
(
T
source
)
{
super
(
COMMAND_LINE_PROPERTY_SOURCE_NAME
,
source
);
}
/**
* Create a new {@link CommandLinePropertySource} having the given name
and backed by
* the given source object.
* Create a new {@link CommandLinePropertySource} having the given name
*
and backed by
the given source object.
*/
public
CommandLinePropertySource
(
String
name
,
T
source
)
{
super
(
name
,
source
);
}
/**
* Specify the name of the special "non-option arguments" property.
The default is
* {@value #DEFAULT_NON_OPTION_ARGS_PROPERTY_NAME}.
* Specify the name of the special "non-option arguments" property.
*
The default is
{@value #DEFAULT_NON_OPTION_ARGS_PROPERTY_NAME}.
*/
public
void
setNonOptionArgsPropertyName
(
String
nonOptionArgsPropertyName
)
{
this
.
nonOptionArgsPropertyName
=
nonOptionArgsPropertyName
;
...
...
@@ -265,6 +268,7 @@ public abstract class CommandLinePropertySource<T> extends EnumerablePropertySou
}
}
/**
* Return whether the set of option arguments parsed from the command line contains
* an option with the given name.
...
...
spring-core/src/main/java/org/springframework/core/env/JOptCommandLinePropertySource.java
浏览文件 @
bb28d198
...
...
@@ -44,10 +44,11 @@ import org.springframework.util.Assert;
*
* See {@link CommandLinePropertySource} for complete general usage examples.
*
* <p>Requires JOpt version
3.0
or higher. Tested against JOpt up until 4.6.
* <p>Requires JOpt version
4.3
or higher. Tested against JOpt up until 4.6.
*
* @author Chris Beams
* @author Juergen Hoeller
* @author Dave Syer
* @since 3.1
* @see CommandLinePropertySource
* @see joptsimple.OptionParser
...
...
@@ -82,11 +83,11 @@ public class JOptCommandLinePropertySource extends CommandLinePropertySource<Opt
@Override
public
String
[]
getPropertyNames
()
{
List
<
String
>
names
=
new
ArrayList
<
String
>();
for
(
OptionSpec
<?>
spec
:
source
.
specs
())
{
for
(
OptionSpec
<?>
spec
:
this
.
source
.
specs
())
{
List
<
String
>
aliases
=
new
ArrayList
<
String
>(
spec
.
options
());
if
(!
aliases
.
isEmpty
())
{
// Only the longest name is used for enumerating
names
.
add
(
aliases
.
get
(
aliases
.
size
()
-
1
));
names
.
add
(
aliases
.
get
(
aliases
.
size
()
-
1
));
}
}
return
names
.
toArray
(
new
String
[
names
.
size
()]);
...
...
spring-webmvc/src/main/java/org/springframework/web/servlet/FlashMap.java
浏览文件 @
bb28d198
...
...
@@ -55,6 +55,7 @@ public final class FlashMap extends HashMap<String, Object> implements Comparabl
private
int
timeToLive
;
/**
* Provide a URL path to help identify the target request for this FlashMap.
* The path may be absolute (e.g. /application/resource) or relative to the
...
...
@@ -69,7 +70,7 @@ public final class FlashMap extends HashMap<String, Object> implements Comparabl
* Return the target URL path or {@code null}.
*/
public
String
getTargetRequestPath
()
{
return
targetRequestPath
;
return
t
his
.
t
argetRequestPath
;
}
/**
...
...
@@ -121,7 +122,7 @@ public final class FlashMap extends HashMap<String, Object> implements Comparabl
*/
public
boolean
isExpired
()
{
if
(
this
.
expirationStartTime
!=
0
)
{
return
(
System
.
currentTimeMillis
()
-
this
.
expirationStartTime
)
>
this
.
timeToLive
*
1000
;
return
(
System
.
currentTimeMillis
()
-
this
.
expirationStartTime
>
this
.
timeToLive
*
1000
)
;
}
else
{
return
false
;
...
...
@@ -135,8 +136,8 @@ public final class FlashMap extends HashMap<String, Object> implements Comparabl
*/
@Override
public
int
compareTo
(
FlashMap
other
)
{
int
thisUrlPath
=
(
this
.
targetRequestPath
!=
null
)
?
1
:
0
;
int
otherUrlPath
=
(
other
.
targetRequestPath
!=
null
)
?
1
:
0
;
int
thisUrlPath
=
(
this
.
targetRequestPath
!=
null
?
1
:
0
)
;
int
otherUrlPath
=
(
other
.
targetRequestPath
!=
null
?
1
:
0
)
;
if
(
thisUrlPath
!=
otherUrlPath
)
{
return
otherUrlPath
-
thisUrlPath
;
}
...
...
@@ -148,7 +149,7 @@ public final class FlashMap extends HashMap<String, Object> implements Comparabl
@Override
public
String
toString
()
{
StringBuilder
sb
=
new
StringBuilder
();
sb
.
append
(
"
[A
ttributes="
).
append
(
super
.
toString
());
sb
.
append
(
"
FlashMap [a
ttributes="
).
append
(
super
.
toString
());
sb
.
append
(
", targetRequestPath="
).
append
(
this
.
targetRequestPath
);
sb
.
append
(
", targetRequestParams="
).
append
(
this
.
targetRequestParams
).
append
(
"]"
);
return
sb
.
toString
();
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录