Class PojoCloudEventData<T>

java.lang.Object
io.cloudevents.core.data.PojoCloudEventData<T>
Type Parameters:
T - the type of the wrapped POJO.
All Implemented Interfaces:
io.cloudevents.CloudEventData

public class PojoCloudEventData<T> extends Object implements io.cloudevents.CloudEventData
An implementation of CloudEventData that wraps any POJO.
  • Method Details

    • getValue

      public T getValue()
      Returns:
      the wrapped POJO
    • toBytes

      public byte[] toBytes()
      Specified by:
      toBytes in interface io.cloudevents.CloudEventData
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • wrap

      public static <T> PojoCloudEventData<T> wrap(T data, PojoCloudEventData.ToBytes<T> mapper)
      Wrap the provided data in a PojoCloudEventData serializable by the provided mapper.
      Type Parameters:
      T - The type of data
      Parameters:
      data - the POJO to wrap
      mapper - converter from data to bytes, used to implement toBytes()
      Returns:
      the new PojoCloudEventData