net.psforever.packet.game.objectcreate
Transform DroppedItemData[T]
for object type T
into ConstructorData
.
This function eliminates the need to have a separate "DroppedFooData" class for every object "Foo."
Two functions normally perform this transformation: an implicit
codec
used in a genericCodec
.
Transform DroppedItemData[T]
for object type T
into ConstructorData
.
This function eliminates the need to have a separate "DroppedFooData" class for every object "Foo."
Two functions normally perform this transformation: an implicit
codec
used in a genericCodec
.
Since actual Generics are utilized, combining the processes eliminates defining to the type data multiple times.
(If that is even possible here.)
Knowledge of the object type is still necessary to recover the original object's data through casting.
Not having to explicitly cast would have been the main upside of having specialized "DroppedFooData" classes.
Use:
DroppedItemCodec.genericCodec(T.codec)
a subclass of ConstructorData
that indicates what type the object is
a Codec
that satisfies the transformation Codec[T] -> T
a String
that explains what the object should be identified as in the log;
defaults to "object"
Codec[ConstructorData]
ConstructorData
(function)