forked from Fraunhofer-AISEC/ids-clearing-house-service
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathHandlerRequest.java
81 lines (64 loc) · 1.91 KB
/
HandlerRequest.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
/*
* Copyright (c) 2023 Microsoft Corporation
*
* This program and the accompanying materials are made available under the
* terms of the Apache License, Version 2.0 which is available at
* https://www.apache.org/licenses/LICENSE-2.0
*
* SPDX-License-Identifier: Apache-2.0
*
* Contributors:
* Microsoft Corporation - Initial implementation
* truzzt GmbH - EDC extension implementation
*
*/
package de.truzzt.clearinghouse.edc.dto;
import de.truzzt.clearinghouse.edc.types.ids.Message;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.util.Objects;
public class HandlerRequest {
private final String pid;
private final Message header;
private final String payload;
private HandlerRequest(String pid, @NotNull Message header, @Nullable String payload) {
this.pid = pid;
this.header = header;
this.payload = payload;
}
public String getPid() {
return pid;
}
public Message getHeader() {
return header;
}
public String getPayload() {
return payload;
}
public static class Builder {
private String pid;
private Message header;
private String payload;
private Builder() {
}
public static Builder newInstance() {
return new Builder();
}
public Builder pid(@NotNull String pid) {
this.pid = pid;
return this;
}
public Builder header(@NotNull Message header) {
this.header = header;
return this;
}
public Builder payload(@NotNull String payload) {
this.payload = payload;
return this;
}
public HandlerRequest build() {
Objects.requireNonNull(header, "Multipart request header is null.");
return new HandlerRequest(pid, header, payload);
}
}
}