Class BaseCloudEventMetadata<T>

    • Field Detail

      • id

        protected final String id
      • specVersion

        protected final String specVersion
      • source

        protected final URI source
      • type

        protected final String type
      • dataContentType

        protected final String dataContentType
      • dataSchema

        protected final URI dataSchema
      • subject

        protected final String subject
      • data

        protected final T data
    • Method Detail

      • validate

        public void validate()
      • getSource

        public URI getSource()
        Description copied from interface: CloudEventMetadata
        Identifies the context in which an event happened. Mandatory attribute.
        Specified by:
        getSource in interface CloudEventMetadata<T>
        Returns:
        the source, cannot be null
      • getSpecVersion

        public String getSpecVersion()
        Description copied from interface: CloudEventMetadata
        The version of the CloudEvents specification which the event uses. Mandatory attribute.
        Specified by:
        getSpecVersion in interface CloudEventMetadata<T>
        Returns:
        the specification version
      • getType

        public String getType()
        Description copied from interface: CloudEventMetadata
        This attribute contains a value describing the type of event related to the originating occurrence. Mandatory attribute.
        Specified by:
        getType in interface CloudEventMetadata<T>
        Returns:
        the type
      • getSubject

        public Optional<String> getSubject()
        Description copied from interface: CloudEventMetadata
        This describes the subject of the event in the context of the event producer (identified by source).
        Specified by:
        getSubject in interface CloudEventMetadata<T>
        Returns:
        the subject if any, empty if none
      • getExtension

        public <A> Optional<A> getExtension​(String name)
        Description copied from interface: CloudEventMetadata
        A CloudEvent may include any number of additional context attributes with distinct names, known as "extension attributes". This method allows retrieving these attributes.
        Specified by:
        getExtension in interface CloudEventMetadata<T>
        Parameters:
        name - the name of the attribute, must not be null
        Returns:
        the value of the attribute, empty if not present.
      • getExtensions

        public Map<String,​Object> getExtensions()
        Description copied from interface: CloudEventMetadata
        A CloudEvent may include any number of additional context attributes with distinct names, known as "extension attributes". This method allows retrieving these attributes.
        Specified by:
        getExtensions in interface CloudEventMetadata<T>
        Returns:
        the map of extension attributes, potentially empty.
      • getData

        public T getData()
        Description copied from interface: CloudEventMetadata
        The event payload. It is the owner message payload.
        Specified by:
        getData in interface CloudEventMetadata<T>
        Returns:
        the payload, can be null