Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
hk581
spring-framework
提交
e3042905
S
spring-framework
项目概览
hk581
/
spring-framework
与 Fork 源项目一致
从无法访问的项目Fork
通知
2
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 搜索 >>
提交
e3042905
编写于
7月 07, 2016
作者:
J
Juergen Hoeller
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Polishing
(cherry picked from commit
6aa5931e
)
上级
942ead75
变更
8
隐藏空白更改
内联
并排
Showing
8 changed file
with
53 addition
and
59 deletion
+53
-59
spring-context/src/test/java/org/springframework/format/datetime/standard/DateTimeFormattingTests.java
...ork/format/datetime/standard/DateTimeFormattingTests.java
+1
-1
spring-core/src/main/java/org/springframework/core/convert/support/ObjectToObjectConverter.java
...amework/core/convert/support/ObjectToObjectConverter.java
+1
-4
spring-core/src/main/java/org/springframework/core/env/ConfigurablePropertyResolver.java
...pringframework/core/env/ConfigurablePropertyResolver.java
+10
-10
spring-core/src/main/java/org/springframework/util/StopWatch.java
...ore/src/main/java/org/springframework/util/StopWatch.java
+2
-2
spring-core/src/test/java/org/springframework/core/SerializableTypeWrapperTests.java
...rg/springframework/core/SerializableTypeWrapperTests.java
+25
-25
spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/method/annotation/AbstractRequestAttributesArgumentResolverTests.java
...ation/AbstractRequestAttributesArgumentResolverTests.java
+6
-9
spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/method/annotation/RequestAttributeMethodArgumentResolverTests.java
...notation/RequestAttributeMethodArgumentResolverTests.java
+4
-4
spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/method/annotation/SessionAttributeMethodArgumentResolverTests.java
...notation/SessionAttributeMethodArgumentResolverTests.java
+4
-4
未找到文件。
spring-context/src/test/java/org/springframework/format/datetime/standard/DateTimeFormattingTests.java
浏览文件 @
e3042905
...
...
@@ -124,7 +124,7 @@ public class DateTimeFormattingTests {
@Test
public
void
testBindLocalDateArray
()
{
MutablePropertyValues
propertyValues
=
new
MutablePropertyValues
();
propertyValues
.
add
(
"localDate"
,
new
String
[]{
"10/31/09"
});
propertyValues
.
add
(
"localDate"
,
new
String
[]
{
"10/31/09"
});
binder
.
bind
(
propertyValues
);
assertEquals
(
0
,
binder
.
getBindingResult
().
getErrorCount
());
}
...
...
spring-core/src/main/java/org/springframework/core/convert/support/ObjectToObjectConverter.java
浏览文件 @
e3042905
/*
* Copyright 2002-201
5
the original author or authors.
* Copyright 2002-201
6
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.
...
...
@@ -185,9 +185,6 @@ final class ObjectToObjectConverter implements ConditionalGenericConverter {
method
=
ClassUtils
.
getStaticMethod
(
targetClass
,
"of"
,
sourceClass
);
if
(
method
==
null
)
{
method
=
ClassUtils
.
getStaticMethod
(
targetClass
,
"from"
,
sourceClass
);
if
(
method
==
null
)
{
return
null
;
}
}
}
return
method
;
...
...
spring-core/src/main/java/org/springframework/core/env/ConfigurablePropertyResolver.java
浏览文件 @
e3042905
/*
* Copyright 2002-201
4
the original author or authors.
* Copyright 2002-201
6
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.
...
...
@@ -19,10 +19,10 @@ package org.springframework.core.env;
import
org.springframework.core.convert.support.ConfigurableConversionService
;
/**
* Configuration interface to be implemented by most if not all {@link PropertyResolver
*
PropertyResolver}
types. Provides facilities for accessing and customizing the
* {@link org.springframework.core.convert.ConversionService ConversionService}
used when
* converting property values from one type to another.
* Configuration interface to be implemented by most if not all {@link PropertyResolver
}
* types. Provides facilities for accessing and customizing the
* {@link org.springframework.core.convert.ConversionService ConversionService}
*
used when
converting property values from one type to another.
*
* @author Chris Beams
* @since 3.1
...
...
@@ -30,7 +30,7 @@ import org.springframework.core.convert.support.ConfigurableConversionService;
public
interface
ConfigurablePropertyResolver
extends
PropertyResolver
{
/**
*
@r
eturn the {@link ConfigurableConversionService} used when performing type
*
R
eturn the {@link ConfigurableConversionService} used when performing type
* conversions on properties.
* <p>The configurable nature of the returned conversion service allows for
* the convenient addition and removal of individual {@code Converter} instances:
...
...
@@ -46,10 +46,10 @@ public interface ConfigurablePropertyResolver extends PropertyResolver {
/**
* Set the {@link ConfigurableConversionService} to be used when performing type
* conversions on properties.
* <p><strong>Note:</strong> as an alternative to fully replacing the
{@code
*
ConversionService}, consider adding or removing individual {@code Converter}
*
instances by drilling into {@link #getConversionService()} and calling methods
* such as {@code #addConverter}.
* <p><strong>Note:</strong> as an alternative to fully replacing the
*
{@code ConversionService}, consider adding or removing individual
*
{@code Converter} instances by drilling into {@link #getConversionService()}
*
and calling methods
such as {@code #addConverter}.
* @see PropertyResolver#getProperty(String, Class)
* @see #getConversionService()
* @see org.springframework.core.convert.converter.ConverterRegistry#addConverter
...
...
spring-core/src/main/java/org/springframework/util/StopWatch.java
浏览文件 @
e3042905
/*
* Copyright 2002-201
5
the original author or authors.
* Copyright 2002-201
6
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.
...
...
@@ -134,7 +134,7 @@ public class StopWatch {
/**
* Stop the current task. The results are undefined if timing
* methods are called without invoking at least one pair
* {@code
#start()} / {@code #
stop()} methods.
* {@code
start()} / {@code
stop()} methods.
* @see #start()
*/
public
void
stop
()
throws
IllegalStateException
{
...
...
spring-core/src/test/java/org/springframework/core/SerializableTypeWrapperTests.java
浏览文件 @
e3042905
/*
* Copyright 2002-201
3
the original author or authors.
* Copyright 2002-201
6
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.
...
...
@@ -46,7 +46,7 @@ public class SerializableTypeWrapperTests {
public
void
forField
()
throws
Exception
{
Type
type
=
SerializableTypeWrapper
.
forField
(
Fields
.
class
.
getField
(
"parameterizedType"
));
assertThat
(
type
.
toString
(),
equalTo
(
"java.util.List<java.lang.String>"
));
assertSerialzable
(
type
);
assertSerial
i
zable
(
type
);
}
@Test
...
...
@@ -54,7 +54,7 @@ public class SerializableTypeWrapperTests {
Method
method
=
Methods
.
class
.
getDeclaredMethod
(
"method"
,
Class
.
class
,
Object
.
class
);
Type
type
=
SerializableTypeWrapper
.
forMethodParameter
(
MethodParameter
.
forMethodOrConstructor
(
method
,
0
));
assertThat
(
type
.
toString
(),
equalTo
(
"java.lang.Class<T>"
));
assertSerialzable
(
type
);
assertSerial
i
zable
(
type
);
}
@Test
...
...
@@ -62,62 +62,62 @@ public class SerializableTypeWrapperTests {
Constructor
<?>
constructor
=
Constructors
.
class
.
getDeclaredConstructor
(
List
.
class
);
Type
type
=
SerializableTypeWrapper
.
forMethodParameter
(
MethodParameter
.
forMethodOrConstructor
(
constructor
,
0
));
assertThat
(
type
.
toString
(),
equalTo
(
"java.util.List<java.lang.String>"
));
assertSerialzable
(
type
);
assertSerial
i
zable
(
type
);
}
@Test
public
void
forGenericSuperClass
()
throws
Exception
{
Type
type
=
SerializableTypeWrapper
.
forGenericSuperclass
(
ArrayList
.
class
);
assertThat
(
type
.
toString
(),
equalTo
(
"java.util.AbstractList<E>"
));
assertSerialzable
(
type
);
assertSerial
i
zable
(
type
);
}
@Test
public
void
forGenericInterfaces
()
throws
Exception
{
Type
type
=
SerializableTypeWrapper
.
forGenericInterfaces
(
List
.
class
)[
0
];
assertThat
(
type
.
toString
(),
equalTo
(
"java.util.Collection<E>"
));
assertSerialzable
(
type
);
assertSerial
i
zable
(
type
);
}
@Test
public
void
forTypeParamters
()
throws
Exception
{
Type
type
=
SerializableTypeWrapper
.
forTypeParameters
(
List
.
class
)[
0
];
assertThat
(
type
.
toString
(),
equalTo
(
"E"
));
assertSerialzable
(
type
);
assertSerial
i
zable
(
type
);
}
@Test
public
void
classType
()
throws
Exception
{
Type
type
=
SerializableTypeWrapper
.
forField
(
Fields
.
class
.
getField
(
"classType"
));
assertThat
(
type
.
toString
(),
equalTo
(
"class java.lang.String"
));
assertSerialzable
(
type
);
assertSerial
i
zable
(
type
);
}
@Test
public
void
genericArrayType
()
throws
Exception
{
GenericArrayType
type
=
(
GenericArrayType
)
SerializableTypeWrapper
.
forField
(
Fields
.
class
.
getField
(
"genericArrayType"
));
assertThat
(
type
.
toString
(),
equalTo
(
"java.util.List<java.lang.String>[]"
));
assertSerialzable
(
type
);
assertSerialzable
(
type
.
getGenericComponentType
());
assertSerial
i
zable
(
type
);
assertSerial
i
zable
(
type
.
getGenericComponentType
());
}
@Test
public
void
parameterizedType
()
throws
Exception
{
ParameterizedType
type
=
(
ParameterizedType
)
SerializableTypeWrapper
.
forField
(
Fields
.
class
.
getField
(
"parameterizedType"
));
assertThat
(
type
.
toString
(),
equalTo
(
"java.util.List<java.lang.String>"
));
assertSerialzable
(
type
);
assertSerialzable
(
type
.
getOwnerType
());
assertSerialzable
(
type
.
getRawType
());
assertSerialzable
(
type
.
getActualTypeArguments
());
assertSerialzable
(
type
.
getActualTypeArguments
()[
0
]);
assertSerial
i
zable
(
type
);
assertSerial
i
zable
(
type
.
getOwnerType
());
assertSerial
i
zable
(
type
.
getRawType
());
assertSerial
i
zable
(
type
.
getActualTypeArguments
());
assertSerial
i
zable
(
type
.
getActualTypeArguments
()[
0
]);
}
@Test
public
void
typeVariableType
()
throws
Exception
{
TypeVariable
<?>
type
=
(
TypeVariable
<?>)
SerializableTypeWrapper
.
forField
(
Fields
.
class
.
getField
(
"typeVariableType"
));
assertThat
(
type
.
toString
(),
equalTo
(
"T"
));
assertSerialzable
(
type
);
assertSerialzable
(
type
.
getBounds
());
assertSerial
i
zable
(
type
);
assertSerial
i
zable
(
type
.
getBounds
());
}
@Test
...
...
@@ -125,13 +125,13 @@ public class SerializableTypeWrapperTests {
ParameterizedType
typeSource
=
(
ParameterizedType
)
SerializableTypeWrapper
.
forField
(
Fields
.
class
.
getField
(
"wildcardType"
));
WildcardType
type
=
(
WildcardType
)
typeSource
.
getActualTypeArguments
()[
0
];
assertThat
(
type
.
toString
(),
equalTo
(
"? extends java.lang.CharSequence"
));
assertSerialzable
(
type
);
assertSerialzable
(
type
.
getLowerBounds
());
assertSerialzable
(
type
.
getUpperBounds
());
assertSerial
i
zable
(
type
);
assertSerial
i
zable
(
type
.
getLowerBounds
());
assertSerial
i
zable
(
type
.
getUpperBounds
());
}
private
void
assertSerialzable
(
Object
source
)
throws
Exception
{
private
void
assertSerial
i
zable
(
Object
source
)
throws
Exception
{
ByteArrayOutputStream
bos
=
new
ByteArrayOutputStream
();
ObjectOutputStream
oos
=
new
ObjectOutputStream
(
bos
);
oos
.
writeObject
(
source
);
...
...
@@ -152,19 +152,19 @@ public class SerializableTypeWrapperTests {
public
T
typeVariableType
;
public
List
<?
extends
CharSequence
>
wildcardType
;
}
static
interface
Methods
{
<
T
>
List
<
T
>
method
(
Class
<
T
>
p1
,
T
p2
);
interface
Methods
{
<
T
>
List
<
T
>
method
(
Class
<
T
>
p1
,
T
p2
);
}
static
class
Constructors
{
public
Constructors
(
List
<
String
>
p
)
{
}
}
}
spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/method/annotation/AbstractRequestAttributesArgumentResolverTests.java
浏览文件 @
e3042905
...
...
@@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
org.springframework.web.servlet.mvc.method.annotation
;
import
java.lang.reflect.Method
;
...
...
@@ -40,14 +41,8 @@ import org.springframework.web.context.request.ServletWebRequest;
import
org.springframework.web.method.support.HandlerMethodArgumentResolver
;
import
org.springframework.web.method.support.ModelAndViewContainer
;
import
static
org
.
junit
.
Assert
.
assertEquals
;
import
static
org
.
junit
.
Assert
.
assertFalse
;
import
static
org
.
junit
.
Assert
.
assertNotNull
;
import
static
org
.
junit
.
Assert
.
assertNull
;
import
static
org
.
junit
.
Assert
.
assertSame
;
import
static
org
.
junit
.
Assert
.
assertTrue
;
import
static
org
.
junit
.
Assert
.
fail
;
import
static
org
.
mockito
.
BDDMockito
.
given
;
import
static
org
.
junit
.
Assert
.*;
import
static
org
.
mockito
.
BDDMockito
.*;
import
static
org
.
mockito
.
Mockito
.
mock
;
/**
...
...
@@ -87,7 +82,7 @@ public abstract class AbstractRequestAttributesArgumentResolverTests {
@Test
public
void
supportsParameter
()
throws
Exception
{
assertTrue
(
this
.
resolver
.
supportsParameter
(
new
MethodParameter
(
this
.
handleMethod
,
0
)));
assertFalse
(
this
.
resolver
.
supportsParameter
(
new
MethodParameter
(
this
.
handleMethod
,
4
)));
assertFalse
(
this
.
resolver
.
supportsParameter
(
new
MethodParameter
(
this
.
handleMethod
,
-
1
)));
}
@Test
...
...
@@ -180,6 +175,8 @@ public abstract class AbstractRequestAttributesArgumentResolverTests {
@SessionAttribute
(
name
=
"foo"
)
Optional
<
Foo
>
optionalFoo
)
{
}
private
static
class
Foo
{
}
}
spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/method/annotation/RequestAttributeMethodArgumentResolverTests.java
浏览文件 @
e3042905
...
...
@@ -13,19 +13,19 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
org.springframework.web.servlet.mvc.method.annotation
;
import
org.springframework.web.context.request.RequestAttributes
;
import
org.springframework.web.method.support.HandlerMethodArgumentResolver
;
/**
* Unit tests for {@link RequestAttributeMethodArgumentResolver}.
*
* @author Rossen Stoyanchev
* @since 4.3
*/
public
class
RequestAttributeMethodArgumentResolverTests
extends
AbstractRequestAttributesArgumentResolverTests
{
public
class
RequestAttributeMethodArgumentResolverTests
extends
AbstractRequestAttributesArgumentResolverTests
{
@Override
protected
HandlerMethodArgumentResolver
createResolver
()
{
...
...
spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/method/annotation/SessionAttributeMethodArgumentResolverTests.java
浏览文件 @
e3042905
...
...
@@ -13,19 +13,19 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
org.springframework.web.servlet.mvc.method.annotation
;
import
org.springframework.web.context.request.RequestAttributes
;
import
org.springframework.web.method.support.HandlerMethodArgumentResolver
;
/**
* Unit tests for {@link SessionAttributeMethodArgumentResolver}.
*
* @author Rossen Stoyanchev
* @since 4.3
*/
public
class
SessionAttributeMethodArgumentResolverTests
extends
AbstractRequestAttributesArgumentResolverTests
{
public
class
SessionAttributeMethodArgumentResolverTests
extends
AbstractRequestAttributesArgumentResolverTests
{
@Override
protected
HandlerMethodArgumentResolver
createResolver
()
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录