License and use of new ExtensionFormat

Signed-off-by: Fabio José <fabiojose@gmail.com>
This commit is contained in:
Fabio José 2019-08-26 17:39:22 -03:00
parent 77bbca5943
commit 3bf55af44d
1 changed files with 21 additions and 6 deletions

View File

@ -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;
import java.net.URI;
@ -20,7 +35,8 @@ import com.fasterxml.jackson.annotation.JsonUnwrapped;
import com.fasterxml.jackson.annotation.JsonInclude.Include;
import io.cloudevents.CloudEvent;
import io.cloudevents.ExtensionFormat;
import io.cloudevents.extensions.ExtensionFormat;
import io.cloudevents.extensions.InMemoryFormat;
/**
* The event implementation
@ -45,11 +61,10 @@ public class CloudEventImpl<T> implements CloudEvent<AttributesImpl, T> {
this.attributes = attributes;
this.data = data;
this.extensions = extensions
.stream()
.collect(Collectors
.toMap(ExtensionFormat::getKey,
ExtensionFormat::getExtension));
this.extensions = extensions.stream()
.map(ExtensionFormat::memory)
.collect(Collectors.toMap(InMemoryFormat::getKey,
InMemoryFormat::getValue));
}
@JsonUnwrapped