Package org.qiunet.utils.args
Class ArgumentKey<T>
java.lang.Object
org.qiunet.utils.args.ArgumentKey<T>
Argument 的key
- Author:
- qiunet 2020-10-16 16:38
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription<Container extends IArgsContainer>
voidclear(Container container) 清除key<Container extends IArgsContainer>
booleancompareAndSet(Container container, T oldVal, T newVal) compare and set value<Container extends IArgsContainer>
TcomputeIfAbsent(Container container, Supplier<T> newVal) 如果没有数据, 就使用指定的Supplier 初始化数据<Container extends IArgsContainer>
Tget(Container container) 从container get 到对应的值.<Container extends IArgsContainer>
booleanisNull(Container container) 容器中指定的key是否有值.<Container extends IArgsContainer>
booleannotNull(Container container) 容器中指定的key是否有值.<Container extends IArgsContainer>
voidremove(Container container) 删除 key<Container extends IArgsContainer>
T设置指定的值到容器.
-
Constructor Details
-
ArgumentKey
public ArgumentKey() -
ArgumentKey
-
ArgumentKey
-
-
Method Details
-
get
从container get 到对应的值.- Type Parameters:
Container- 容器类- Parameters:
container- 容器对象- Returns:
- 对应的值
-
set
设置指定的值到容器.- Type Parameters:
Container- 容器类- Parameters:
container- 容器对象newVal- 值- Returns:
- 返回旧值
-
isNull
容器中指定的key是否有值.- Type Parameters:
Container- 容器类- Parameters:
container- 容器对象- Returns:
- true 空
-
notNull
容器中指定的key是否有值.- Type Parameters:
Container- 容器类- Parameters:
container- 容器对象- Returns:
- true 非空
-
compareAndSet
public <Container extends IArgsContainer> boolean compareAndSet(Container container, T oldVal, T newVal) compare and set value- Type Parameters:
Container- 容器类- Parameters:
container- 容器对象oldVal- 旧值newVal- 新值- Returns:
- cas的结果 true 为成功.
-
computeIfAbsent
public <Container extends IArgsContainer> T computeIfAbsent(Container container, Supplier<T> newVal) 如果没有数据, 就使用指定的Supplier 初始化数据- Type Parameters:
Container- 容器类型- Parameters:
container- 容器对象newVal- 构造初始值的 Supplier- Returns:
- 现有的. 或者新的值
-
remove
删除 key- Type Parameters:
Container- 容器类型- Parameters:
container- 容器对象
-
clear
清除key- Type Parameters:
Container- 容器类型- Parameters:
container- 容器对象
-