License and use of new ExtensionFormat
Signed-off-by: Fabio José <fabiojose@gmail.com>
This commit is contained in:
parent
77bbca5943
commit
3bf55af44d
|
@ -1,3 +1,18 @@
|
||||||
|
/**
|
||||||
|
* Copyright 2019 The CloudEvents Authors
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
package io.cloudevents.v03;
|
package io.cloudevents.v03;
|
||||||
|
|
||||||
import java.net.URI;
|
import java.net.URI;
|
||||||
|
@ -20,7 +35,8 @@ import com.fasterxml.jackson.annotation.JsonUnwrapped;
|
||||||
import com.fasterxml.jackson.annotation.JsonInclude.Include;
|
import com.fasterxml.jackson.annotation.JsonInclude.Include;
|
||||||
|
|
||||||
import io.cloudevents.CloudEvent;
|
import io.cloudevents.CloudEvent;
|
||||||
import io.cloudevents.ExtensionFormat;
|
import io.cloudevents.extensions.ExtensionFormat;
|
||||||
|
import io.cloudevents.extensions.InMemoryFormat;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The event implementation
|
* The event implementation
|
||||||
|
@ -45,11 +61,10 @@ public class CloudEventImpl<T> implements CloudEvent<AttributesImpl, T> {
|
||||||
this.attributes = attributes;
|
this.attributes = attributes;
|
||||||
this.data = data;
|
this.data = data;
|
||||||
|
|
||||||
this.extensions = extensions
|
this.extensions = extensions.stream()
|
||||||
.stream()
|
.map(ExtensionFormat::memory)
|
||||||
.collect(Collectors
|
.collect(Collectors.toMap(InMemoryFormat::getKey,
|
||||||
.toMap(ExtensionFormat::getKey,
|
InMemoryFormat::getValue));
|
||||||
ExtensionFormat::getExtension));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@JsonUnwrapped
|
@JsonUnwrapped
|
||||||
|
|
Loading…
Reference in New Issue