9
0
mirror of https://github.com/Xiao-MoMi/craft-engine.git synced 2025-12-19 15:09:15 +00:00

contextholder添加get方法

This commit is contained in:
Catnies
2025-12-14 23:54:40 +08:00
parent b5f4bdda48
commit d3ea25aaa8

View File

@@ -64,7 +64,7 @@ public class ContextHolder {
}
@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);
}