From 49eadec2013a6771c94998c665d54c55180588bc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rub=C3=A9n?= <44579213+Rubenicos@users.noreply.github.com> Date: Tue, 17 Sep 2024 18:06:04 -0600 Subject: [PATCH] Add view of all component types --- src/main/java/com/saicone/rtag/data/ComponentType.java | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/main/java/com/saicone/rtag/data/ComponentType.java b/src/main/java/com/saicone/rtag/data/ComponentType.java index 0b8e1d4..6b7a192 100644 --- a/src/main/java/com/saicone/rtag/data/ComponentType.java +++ b/src/main/java/com/saicone/rtag/data/ComponentType.java @@ -14,6 +14,7 @@ import java.lang.invoke.MethodHandle; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; +import java.util.Collections; import java.util.HashMap; import java.util.Map; import java.util.Optional; @@ -170,6 +171,15 @@ public static Object of(String name) { return TYPES.get(key(name)); } + /** + * Get all DataComponentType objects associated with its ID. + * + * @return an unmodifiable view of all types. + */ + public static Map all() { + return Collections.unmodifiableMap(TYPES); + } + /** * Get declared codec from DataComponentType instance or ID.
* Take in count that not all the component types provide a codec instance.