Class ByteValueList

java.lang.Object
com.iohao.net.framework.protocol.wrapper.ByteValueList

@ProtobufClass public final class ByteValueList extends Object
Protocol wrapper for a list of byte array values.

Wraps a List of byte[] for protobuf serialization. Each element in the list is an individually encoded object, enabling transport of heterogeneous or complex object lists over the wire. An empty singleton is cached for the no-data case.

Author:
渔民小镇
date:
2023-04-17
  • Field Details

    • values

      @Protobuf(fieldType=BYTES, order=1) public List<byte[]> values
      the wrapped list of encoded byte arrays
  • Constructor Details

    • ByteValueList

      public ByteValueList()
  • Method Details

    • of

      public static <T> ByteValueList of(Collection<T> values)
      Encode each element in the collection using the default codec and wrap the results.
      Type Parameters:
      T - the element type
      Parameters:
      values - the collection of objects to encode
      Returns:
      a ByteValueList containing the encoded byte arrays
    • of

      public static <T> ByteValueList of(Collection<T> values, DataCodec codec)
      Encode each element in the collection using the specified codec and wrap the results.
      Type Parameters:
      T - the element type
      Parameters:
      values - the collection of objects to encode
      codec - the codec to use for encoding each element
      Returns:
      a ByteValueList containing the encoded byte arrays, or a cached empty instance
    • toString

      public String toString()
      Overrides:
      toString in class Object