ISingleSlotTypeFactory

This interface is a factory for creating a single slot type. If custom slot types are to be introduced, a class must be created for each slot type that implements this interface. Likewise, a class must be created that implements the ISlot interface.

Slot type

The factory identifies itself with the produced slot type.

@NotNull
CSlotType getType();

Class of the transported value

Slots always transport a certain JAVA type. This is returned here.

Creation of a slot from an object

The creation of a slot from an object is done here.

@Nullable
ISlot fromObject(@NotNull CSlotType aType,
                 @Nullable Object aValue);

Creating a slot from a DataInput stream

The method reads the slot from a DataInput stream.

@Nullable
ISlot readSlot(@NotNull DataInput aStream,
               @NotNull CSlotType aType) throws IOException;

Creating a slot from JSON

The method reads the slot from a JSON element. Most often, the object passed is a string representation of the value. However, for some data types it is more efficient to transport the data as binary data. Byte arrays, for example, put their value into the map as a byte array, to save as much space as possible. Thus, a binary block is then transported in addition to the pure JSON text. In the JSON text part in this case contains only the reference to a binary block.

@Nullable
ISlot fromJson(@Nullable Object aValue,
               @NotNull Map<Integer, byte[]> aBinaries);

nyssr.net - Innovative Distributed System