Исправления в StorylineContext
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
2f2f3319a2
commit
1dabb026f3
@ -8,7 +8,7 @@ import java.util.Map;
|
|||||||
|
|
||||||
public interface StorylineContext {
|
public interface StorylineContext {
|
||||||
|
|
||||||
Uni<Void> save(@NotNull String personId, @NotNull ContextKey<?> key, Object objectForSave);
|
<T> Uni<Void> save(@NotNull String personId, @NotNull ContextKey<T> key, T objectForSave);
|
||||||
|
|
||||||
<T> Uni<T> getByKey(@NotNull String personId, @NotNull ContextKey<T> key);
|
<T> Uni<T> getByKey(@NotNull String personId, @NotNull ContextKey<T> key);
|
||||||
|
|
||||||
|
@ -8,7 +8,7 @@ import java.util.Optional;
|
|||||||
|
|
||||||
public interface StorylineContext {
|
public interface StorylineContext {
|
||||||
|
|
||||||
void save(@NotNull String personId, @NotNull ContextKey<?> key, Object objectForSave);
|
<T> void save(@NotNull String personId, @NotNull ContextKey<T> key, T objectForSave);
|
||||||
|
|
||||||
<T> Optional<T> getByKey(@NotNull String personId, @NotNull ContextKey<T> key);
|
<T> Optional<T> getByKey(@NotNull String personId, @NotNull ContextKey<T> key);
|
||||||
|
|
||||||
|
@ -16,7 +16,8 @@ public class StorylineContextMapImpl implements StorylineContext {
|
|||||||
|
|
||||||
private final Map<String, Map<String, Object>> map = new HashMap<>();
|
private final Map<String, Map<String, Object>> map = new HashMap<>();
|
||||||
|
|
||||||
public Uni<Void> save(@NotNull String personId, @NotNull ContextKey<?> key, Object objectForSave) {
|
@Override
|
||||||
|
public <T> Uni<Void> save(@NotNull String personId, @NotNull ContextKey<T> key, T objectForSave) {
|
||||||
isNotNull(personId, key);
|
isNotNull(personId, key);
|
||||||
map.computeIfAbsent(personId, k -> new HashMap<>()).put(key.getValue(), objectForSave);
|
map.computeIfAbsent(personId, k -> new HashMap<>()).put(key.getValue(), objectForSave);
|
||||||
return Uni.createFrom().voidItem();
|
return Uni.createFrom().voidItem();
|
||||||
|
@ -16,8 +16,9 @@ public class StorylineContextMapImpl implements StorylineContext {
|
|||||||
|
|
||||||
private final Map<String, Map<String, Object>> map = new HashMap<>();
|
private final Map<String, Map<String, Object>> map = new HashMap<>();
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void save(@NotNull String personId, @NotNull ContextKey<?> key, Object objectForSave) {
|
public <T> void save(@NotNull String personId, @NotNull ContextKey<T> key, T objectForSave) {
|
||||||
isNotNull(personId, key);
|
isNotNull(personId, key);
|
||||||
map.computeIfAbsent(personId, k -> new HashMap<>()).put(key.getValue(), objectForSave);
|
map.computeIfAbsent(personId, k -> new HashMap<>()).put(key.getValue(), objectForSave);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user