Skip to content

Commit a783a27

Browse files
Add the method BytesCloudEventData#wrap to be consistent with cloudevents#289
Signed-off-by: Francesco Guardiani <francescoguard@gmail.com>
1 parent 8ac23dc commit a783a27

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

core/src/main/java/io/cloudevents/core/data/BytesCloudEventData.java

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@ public class BytesCloudEventData implements CloudEventData {
99

1010
private final byte[] value;
1111

12+
/**
13+
* @deprecated use {@link BytesCloudEventData#wrap(byte[])}
14+
*/
1215
public BytesCloudEventData(byte[] value) {
1316
Objects.requireNonNull(value);
1417
this.value = value;
@@ -38,4 +41,12 @@ public String toString() {
3841
"value=" + Arrays.toString(value) +
3942
'}';
4043
}
44+
45+
/**
46+
* @param value byte array to wrap
47+
* @return byte array wrapped in a {@link BytesCloudEventData}, which implements {@link CloudEventData}.
48+
*/
49+
public BytesCloudEventData wrap(byte[] value) {
50+
return new BytesCloudEventData(value);
51+
}
4152
}

0 commit comments

Comments
 (0)