mirror of
https://github.com/Xiao-MoMi/craft-engine.git
synced 2025-12-20 07:29:17 +00:00
contextholder添加get方法
This commit is contained in:
@@ -64,7 +64,7 @@ public class ContextHolder {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
public <T> T get(ContextKey<T> parameter) {
|
public <T> T getOrNull(ContextKey<T> parameter) {
|
||||||
return (T) Optional.ofNullable(this.params.get(parameter)).map(Supplier::get).orElse(null);
|
return (T) Optional.ofNullable(this.params.get(parameter)).map(Supplier::get).orElse(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user