Skip to content

Commit

Permalink
remove empty.
Browse files Browse the repository at this point in the history
  • Loading branch information
portlek committed Sep 30, 2024
1 parent b0dfdab commit b5a34b1
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 73 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,4 @@ static TypedKeyStorageFactory create() {

@NotNull
TypedKeyStorageImmutableBuilder createImmutableBuilder(@NotNull Map<TypedKey<?>, Object> base);

@NotNull
TypedKeyStorageImmutable createImmutableEmpty();
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,4 @@ public TypedKeyStorageImmutableBuilder createImmutableBuilder(
) {
return new TypedKeyStorageImmutableBuilderImpl(base);
}

@NotNull
@Override
public TypedKeyStorageImmutable createImmutableEmpty() {
return TypedKeyStorageImmutableEmpty.INSTANCE;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,15 @@ public interface TypedKeyStorageImmutable {
@Nullable
<T> T getUnchecked(@NotNull String key);

@NotNull
<T> T getOrThrow(@NotNull TypedKey<T> key);

@NotNull
Object getOrThrow(@NotNull String key);

@NotNull
<T> T getUncheckedOrThrow(@NotNull String key);

boolean contains(@NotNull TypedKey<?> key);

@NotNull
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import java.util.Collection;
import java.util.Collections;
import java.util.Map;
import net.infumia.frame.util.Preconditions;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

Expand Down Expand Up @@ -45,6 +46,24 @@ public <T> T getUnchecked(@NotNull final String key) {
.orElse(null);
}

@NotNull
@Override
public <T> T getOrThrow(@NotNull final TypedKey<T> key) {
return Preconditions.argumentNotNull(this.get(key), "Key '%s' not found!", key);
}

@NotNull
@Override
public Object getOrThrow(@NotNull final String key) {
return Preconditions.argumentNotNull(this.get(key), "Key '%s' not found!", key);
}

@NotNull
@Override
public <T> T getUncheckedOrThrow(@NotNull final String key) {
return Preconditions.argumentNotNull(this.getUnchecked(key), "Key '%s' not found!", key);
}

@Override
public boolean contains(@NotNull final TypedKey<?> key) {
return this.map.containsKey(key);
Expand Down

0 comments on commit b5a34b1

Please sign in to comment.