Class CollectionObjectSerializer
java.lang.Object
eu.cloudnetservice.driver.impl.network.object.serializers.CollectionObjectSerializer
- All Implemented Interfaces:
eu.cloudnetservice.driver.network.object.ObjectSerializer<Collection<?>>
public final class CollectionObjectSerializer
extends Object
implements eu.cloudnetservice.driver.network.object.ObjectSerializer<Collection<?>>
An object serializer which can read and write any type of collection to/from a buffer.
- Since:
- 4.0
-
Field Summary
Fields -
Constructor Summary
ConstructorsModifierConstructorDescriptionprivateCollectionObjectSerializer(@NonNull IntFunction<Collection<Object>> collectionFactory) Constructs a new collection object serializer instance. -
Method Summary
Modifier and TypeMethodDescriptionof(@NonNull IntFunction<Collection<Object>> collectionFactory) Constructs a new collection object serializer instance.read(@NonNull eu.cloudnetservice.driver.network.buffer.DataBuf source, @NonNull Type type, @NonNull eu.cloudnetservice.driver.network.object.ObjectMapper caller) voidMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface eu.cloudnetservice.driver.network.object.ObjectSerializer
preReadCheckAccepts, preWriteCheckAccepts
-
Field Details
-
collectionFactory
-
-
Constructor Details
-
CollectionObjectSerializer
private CollectionObjectSerializer(@NonNull @NonNull IntFunction<Collection<Object>> collectionFactory) Constructs a new collection object serializer instance.- Parameters:
collectionFactory- the factory to create the underlying collection instance.- Throws:
NullPointerException- if the given factory is null.
-
-
Method Details
-
of
@NonNull public static @NonNull CollectionObjectSerializer of(@NonNull @NonNull IntFunction<Collection<Object>> collectionFactory) Constructs a new collection object serializer instance.- Parameters:
collectionFactory- the factory to create the collection instance, receiving the site as parameter.- Returns:
- the collection factory instance.
- Throws:
NullPointerException- if the given factory is null.
-
read
@Nullable public @Nullable Collection<?> read(@NonNull @NonNull eu.cloudnetservice.driver.network.buffer.DataBuf source, @NonNull @NonNull Type type, @NonNull @NonNull eu.cloudnetservice.driver.network.object.ObjectMapper caller) - Specified by:
readin interfaceeu.cloudnetservice.driver.network.object.ObjectSerializer<Collection<?>>
-
write
public void write(@NonNull eu.cloudnetservice.driver.network.buffer.DataBuf.Mutable dataBuf, @NonNull @NonNull Collection<?> object, @NonNull @NonNull Type type, @NonNull @NonNull eu.cloudnetservice.driver.network.object.ObjectMapper caller) - Specified by:
writein interfaceeu.cloudnetservice.driver.network.object.ObjectSerializer<Collection<?>>
-