Remove Experimental from TypedKey (#12134)
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
package io.papermc.paper.registry;
|
||||
|
||||
import io.papermc.paper.datacomponent.DataComponentType;
|
||||
import io.papermc.paper.registry.tag.TagKey;
|
||||
import net.kyori.adventure.key.Key;
|
||||
import net.kyori.adventure.key.KeyPattern;
|
||||
import net.kyori.adventure.key.Keyed;
|
||||
@@ -209,7 +210,6 @@ public sealed interface RegistryKey<T> extends Keyed permits RegistryKeyImpl {
|
||||
* @param key the key of the typed key.
|
||||
* @return the constructed typed key.
|
||||
*/
|
||||
@ApiStatus.Experimental
|
||||
default TypedKey<T> typedKey(final Key key) {
|
||||
return TypedKey.create(this, key);
|
||||
}
|
||||
@@ -220,8 +220,29 @@ public sealed interface RegistryKey<T> extends Keyed permits RegistryKeyImpl {
|
||||
* @param key the string representation of the key that will be passed to {@link Key#key(String)}.
|
||||
* @return the constructed typed key.
|
||||
*/
|
||||
@ApiStatus.Experimental
|
||||
default TypedKey<T> typedKey(final @KeyPattern String key) {
|
||||
default TypedKey<T> typedKey(@KeyPattern final String key) {
|
||||
return TypedKey.create(this, key);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a new {@link TagKey} for this registry given the tag key's key.
|
||||
*
|
||||
* @param key the key of the typed key.
|
||||
* @return the constructed tag key.
|
||||
*/
|
||||
@ApiStatus.Experimental
|
||||
default TagKey<T> tagKey(final Key key) {
|
||||
return TagKey.create(this, key);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a new {@link TagKey} for this registry given the tag key's key.
|
||||
*
|
||||
* @param key the string representation of the key that will be passed to {@link Key#key(String)}.
|
||||
* @return the constructed tag key.
|
||||
*/
|
||||
@ApiStatus.Experimental
|
||||
default TagKey<T> tagKey(@KeyPattern final String key) {
|
||||
return TagKey.create(this, key);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,7 +11,6 @@ import org.jspecify.annotations.NullMarked;
|
||||
*
|
||||
* @param <T> the value type for the registry
|
||||
*/
|
||||
@ApiStatus.Experimental
|
||||
@NullMarked
|
||||
public sealed interface TypedKey<T> extends Key permits TypedKeyImpl {
|
||||
|
||||
@@ -39,7 +38,6 @@ public sealed interface TypedKey<T> extends Key permits TypedKeyImpl {
|
||||
* @param <T> value type
|
||||
* @return a new key for the value key and registry key
|
||||
*/
|
||||
@ApiStatus.Experimental
|
||||
static <T> TypedKey<T> create(final RegistryKey<T> registryKey, final Key key) {
|
||||
return new TypedKeyImpl<>(key, registryKey);
|
||||
}
|
||||
@@ -53,8 +51,7 @@ public sealed interface TypedKey<T> extends Key permits TypedKeyImpl {
|
||||
* @return a new key for the value key and registry key
|
||||
* @see Key#key(String)
|
||||
*/
|
||||
@ApiStatus.Experimental
|
||||
static <T> TypedKey<T> create(final RegistryKey<T> registryKey, final @KeyPattern String key) {
|
||||
static <T> TypedKey<T> create(final RegistryKey<T> registryKey, @KeyPattern final String key) {
|
||||
return create(registryKey, Key.key(key));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
package io.papermc.paper.registry.tag;
|
||||
|
||||
import io.papermc.paper.registry.RegistryKey;
|
||||
import io.papermc.paper.registry.TypedKey;
|
||||
import net.kyori.adventure.key.Key;
|
||||
import net.kyori.adventure.key.KeyPattern;
|
||||
import net.kyori.adventure.key.Keyed;
|
||||
import org.jetbrains.annotations.ApiStatus;
|
||||
import org.jetbrains.annotations.Contract;
|
||||
@@ -15,15 +17,29 @@ public sealed interface TagKey<T> extends Keyed permits TagKeyImpl {
|
||||
* Creates a new tag key for a registry.
|
||||
*
|
||||
* @param registryKey the registry for the tag
|
||||
* @param key the specific key for the tag
|
||||
* @param key the specific key for the tag
|
||||
* @param <T> the registry value type
|
||||
* @return a new tag key
|
||||
* @param <T> the registry value type
|
||||
*/
|
||||
@Contract(value = "_, _ -> new", pure = true)
|
||||
static <T> TagKey<T> create(final RegistryKey<T> registryKey, final Key key) {
|
||||
return new TagKeyImpl<>(registryKey, key);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new tag key for a registry.
|
||||
*
|
||||
* @param registryKey the registry for the tag
|
||||
* @param key the string version of a {@link Key} that will be passed to {@link Key#key(String)} for parsing.
|
||||
* @param <T> the registry value type
|
||||
* @return a new tag key
|
||||
* @see Key#key(String)
|
||||
*/
|
||||
@ApiStatus.Experimental
|
||||
static <T> TagKey<T> create(final RegistryKey<T> registryKey, @KeyPattern final String key) {
|
||||
return create(registryKey, Key.key(key));
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the registry key for this tag key.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user