Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
爱吃血肠
spring-framework
提交
b4cf4710
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 搜索 >>
提交
b4cf4710
编写于
10月 30, 2019
作者:
J
Juergen Hoeller
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Polishing
上级
82751141
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
40 addition
and
23 deletion
+40
-23
spring-context/src/main/java/org/springframework/context/annotation/DeferredImportSelector.java
...gframework/context/annotation/DeferredImportSelector.java
+8
-6
spring-core/src/main/java/org/springframework/util/unit/DataUnit.java
...src/main/java/org/springframework/util/unit/DataUnit.java
+29
-14
spring-messaging/src/main/java/org/springframework/messaging/simp/user/MultiServerUserRegistry.java
...ramework/messaging/simp/user/MultiServerUserRegistry.java
+0
-1
spring-tx/src/test/java/org/springframework/transaction/interceptor/TransactionInterceptorTests.java
.../transaction/interceptor/TransactionInterceptorTests.java
+3
-2
未找到文件。
spring-context/src/main/java/org/springframework/context/annotation/DeferredImportSelector.java
浏览文件 @
b4cf4710
...
...
@@ -16,8 +16,6 @@
package
org.springframework.context.annotation
;
import
java.util.Objects
;
import
org.springframework.core.type.AnnotationMetadata
;
import
org.springframework.lang.Nullable
;
...
...
@@ -100,7 +98,7 @@ public interface DeferredImportSelector extends ImportSelector {
}
@Override
public
boolean
equals
(
Object
other
)
{
public
boolean
equals
(
@Nullable
Object
other
)
{
if
(
this
==
other
)
{
return
true
;
}
...
...
@@ -108,13 +106,17 @@ public interface DeferredImportSelector extends ImportSelector {
return
false
;
}
Entry
entry
=
(
Entry
)
other
;
return
(
Objects
.
equals
(
this
.
metadata
,
entry
.
metadata
)
&&
Objects
.
equals
(
this
.
importClassName
,
entry
.
importClassName
));
return
(
this
.
metadata
.
equals
(
entry
.
metadata
)
&&
this
.
importClassName
.
equals
(
entry
.
importClassName
));
}
@Override
public
int
hashCode
()
{
return
Objects
.
hash
(
this
.
metadata
,
this
.
importClassName
);
return
(
this
.
metadata
.
hashCode
()
*
31
+
this
.
importClassName
.
hashCode
());
}
@Override
public
String
toString
()
{
return
this
.
importClassName
;
}
}
}
...
...
spring-core/src/main/java/org/springframework/util/unit/DataUnit.java
浏览文件 @
b4cf4710
/*
* Copyright 2002-201
8
the original author or authors.
* Copyright 2002-201
9
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.
...
...
@@ -16,38 +16,53 @@
package
org.springframework.util.unit
;
import
java.util.Objects
;
/**
* A standard set of data size units.
* A standard set of {@link DataSize} units.
*
* <p>The unit prefixes used in this class are
* <a href="https://en.wikipedia.org/wiki/Binary_prefix">binary prefixes</a>
* indicating multiplication by powers of 2. The following table displays the
* enum constants defined in this class and corresponding values.
*
* <p>
* <table border="1">
* <tr><th>Constant</th><th>Data Size</th><th>Power of 2</th><th>Size in Bytes</th></tr>
* <tr><td>{@link #BYTES}</td><td>1B</td><td>2^0</td><td>1</td></tr>
* <tr><td>{@link #KILOBYTES}</td><td>1KB</td><td>2^10</td><td>1,024</td></tr>
* <tr><td>{@link #MEGABYTES}</td><td>1MB</td><td>2^20</td><td>1,048,576</td></tr>
* <tr><td>{@link #GIGABYTES}</td><td>1GB</td><td>2^30</td><td>1,073,741,824</td></tr>
* <tr><td>{@link #TERABYTES}</td><td>1TB</td><td>2^40</td><td>1,099,511,627,776</td></tr>
* </table>
*
* @author Stephane Nicoll
* @author Sam Brannen
* @since 5.1
* @see DataSize
*/
public
enum
DataUnit
{
/**
* Bytes.
* Bytes
, represented by suffix {@code B}
.
*/
BYTES
(
"B"
,
DataSize
.
ofBytes
(
1
)),
/**
* Kilobytes.
* Kilobytes
, represented by suffix {@code KB}
.
*/
KILOBYTES
(
"KB"
,
DataSize
.
ofKilobytes
(
1
)),
/**
* Megabytes.
* Megabytes
, represented by suffix {@code MB}
.
*/
MEGABYTES
(
"MB"
,
DataSize
.
ofMegabytes
(
1
)),
/**
* Gigabytes.
* Gigabytes
, represented by suffix {@code GB}
.
*/
GIGABYTES
(
"GB"
,
DataSize
.
ofGigabytes
(
1
)),
/**
* Terabytes.
* Terabytes
, represented by suffix {@code TB}
.
*/
TERABYTES
(
"TB"
,
DataSize
.
ofTerabytes
(
1
));
...
...
@@ -68,18 +83,18 @@ public enum DataUnit {
/**
* Return the {@link DataUnit} matching the specified {@code suffix}.
* @param suffix one of the standard suffix
* @param suffix one of the standard suffix
es
* @return the {@link DataUnit} matching the specified {@code suffix}
* @throws IllegalArgumentException if the suffix does not match
any
* of this enum's constants
* @throws IllegalArgumentException if the suffix does not match
the suffix
* of
any of
this enum's constants
*/
public
static
DataUnit
fromSuffix
(
String
suffix
)
{
for
(
DataUnit
candidate
:
values
())
{
if
(
Objects
.
equals
(
candidate
.
suffix
,
suffix
))
{
if
(
candidate
.
suffix
.
equals
(
suffix
))
{
return
candidate
;
}
}
throw
new
IllegalArgumentException
(
"Unknown
unit
'"
+
suffix
+
"'"
);
throw
new
IllegalArgumentException
(
"Unknown
data unit suffix
'"
+
suffix
+
"'"
);
}
}
spring-messaging/src/main/java/org/springframework/messaging/simp/user/MultiServerUserRegistry.java
浏览文件 @
b4cf4710
...
...
@@ -560,7 +560,6 @@ public class MultiServerUserRegistry implements SimpUserRegistry, SmartApplicati
}
return
map
;
}
}
}
spring-tx/src/test/java/org/springframework/transaction/interceptor/TransactionInterceptorTests.java
浏览文件 @
b4cf4710
/*
* Copyright 2002-201
8
the original author or authors.
* Copyright 2002-201
9
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.
...
...
@@ -40,6 +40,7 @@ import static org.mockito.BDDMockito.*;
* Mock object based tests for TransactionInterceptor.
*
* @author Rod Johnson
* @author Juergen Hoeller
* @since 16.03.2003
*/
public
class
TransactionInterceptorTests
extends
AbstractTransactionAspectTests
{
...
...
@@ -49,7 +50,7 @@ public class TransactionInterceptorTests extends AbstractTransactionAspectTests
@Override
protected
Object
advised
(
Object
target
,
PlatformTransactionManager
ptm
,
TransactionAttributeSource
[]
tas
)
throws
Exception
{
protected
Object
advised
(
Object
target
,
PlatformTransactionManager
ptm
,
TransactionAttributeSource
[]
tas
)
{
TransactionInterceptor
ti
=
new
TransactionInterceptor
();
ti
.
setTransactionManager
(
ptm
);
ti
.
setTransactionAttributeSources
(
tas
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录