1010 * as well as to register custom serializers and deserializers for different types.
1111 */
1212@ NullMarked
13- public final class NBT {
13+ public final class NBT extends Serializer {
1414 private final Serializer serializer ;
1515
1616 /**
@@ -38,7 +38,9 @@ public static Builder builder() {
3838 * @param type the class of the type to deserialize into
3939 * @param <T> the type of the object to be returned
4040 * @return the deserialized object of the specified type
41+ * @deprecated use {@link #deserialize(Tag, Class)} instead
4142 */
43+ @ Deprecated (forRemoval = true , since = "2.4.0" )
4244 public <T > T fromTag (Tag tag , Class <T > type ) {
4345 return serializer .deserialize (tag , type );
4446 }
@@ -50,7 +52,9 @@ public <T> T fromTag(Tag tag, Class<T> type) {
5052 * @param type the type to deserialize into
5153 * @param <T> the type of the object to be returned
5254 * @return the deserialized object of the specified type
55+ * @deprecated use {@link #deserialize(Tag, Type)} instead
5356 */
57+ @ Deprecated (forRemoval = true , since = "2.4.0" )
5458 public <T > T fromTag (Tag tag , Type type ) {
5559 return serializer .deserialize (tag , type );
5660 }
@@ -60,7 +64,9 @@ public <T> T fromTag(Tag tag, Type type) {
6064 *
6165 * @param object the object to be serialized
6266 * @return the Tag representation of the provided object
67+ * @deprecated use {@link #serialize(Object)} instead
6368 */
69+ @ Deprecated (forRemoval = true , since = "2.4.0" )
6470 public Tag toTag (Object object ) {
6571 return serializer .serialize (object );
6672 }
@@ -71,7 +77,9 @@ public Tag toTag(Object object) {
7177 * @param object the object to be serialized
7278 * @param type the class type to be used for serialization
7379 * @return the serialized tag representation of the object
80+ * @deprecated use {@link #serialize(Object, Class)} instead
7481 */
82+ @ Deprecated (forRemoval = true , since = "2.4.0" )
7583 public Tag toTag (Object object , Class <?> type ) {
7684 return serializer .serialize (object , type );
7785 }
@@ -82,7 +90,9 @@ public Tag toTag(Object object, Class<?> type) {
8290 * @param object the object to be serialized
8391 * @param type the type to be used for serialization
8492 * @return the serialized tag representation of the object
93+ * @deprecated use {@link #serialize(Object, Type)} instead
8594 */
95+ @ Deprecated (forRemoval = true , since = "2.4.0" )
8696 public Tag toTag (Object object , Type type ) {
8797 return serializer .serialize (object , type );
8898 }
@@ -97,10 +107,10 @@ public static class Builder {
97107 * Registers a custom adapter for both serialization and deserialization of the specified type
98108 * and its subtypes.
99109 *
100- * @param <T> the type of the objects handled by the adapter
101- * @param type the class of the type for which the adapter is to be registered
110+ * @param <T> the type of the objects handled by the adapter
111+ * @param type the class of the type for which the adapter is to be registered
102112 * @param adapter the instance of TagAdapter to handle both serialization and deserialization
103- * of the specified type and its subtypes
113+ * of the specified type and its subtypes
104114 * @return the current builder instance for chaining
105115 */
106116 public <T > Builder registerTypeHierarchyAdapter (Class <?> type , TagAdapter <T > adapter ) {
0 commit comments