1
15
16 package software.amazon.awssdk.protocols.xml.internal.unmarshall;
17
18 import software.amazon.awssdk.annotations.SdkInternalApi;
19 import software.amazon.awssdk.core.protocol.MarshallLocation;
20 import software.amazon.awssdk.core.protocol.MarshallingType;
21 import software.amazon.awssdk.protocols.core.AbstractMarshallingRegistry;
22
23 @SdkInternalApi
24 public final class XmlUnmarshallerRegistry extends AbstractMarshallingRegistry {
25
26 private XmlUnmarshallerRegistry(Builder builder) {
27 super(builder);
28 }
29
30 @SuppressWarnings("unchecked")
31 public <T> XmlUnmarshaller<Object> getUnmarshaller(MarshallLocation marshallLocation, MarshallingType<T> marshallingType) {
32 return (XmlUnmarshaller<Object>) get(marshallLocation, marshallingType);
33 }
34
35
38 public static Builder builder() {
39 return new Builder();
40 }
41
42
45 public static final class Builder extends AbstractMarshallingRegistry.Builder {
46
47 private Builder() {
48 }
49
50 public <T> Builder payloadUnmarshaller(MarshallingType<T> marshallingType,
51 XmlUnmarshaller<T> marshaller) {
52 register(MarshallLocation.PAYLOAD, marshallingType, marshaller);
53 return this;
54 }
55
56 public <T> Builder headerUnmarshaller(MarshallingType<T> marshallingType,
57 XmlUnmarshaller<T> marshaller) {
58 register(MarshallLocation.HEADER, marshallingType, marshaller);
59 return this;
60 }
61
62 public <T> Builder statusCodeUnmarshaller(MarshallingType<T> marshallingType,
63 XmlUnmarshaller<T> marshaller) {
64 register(MarshallLocation.STATUS_CODE, marshallingType, marshaller);
65 return this;
66 }
67
68
71 public XmlUnmarshallerRegistry build() {
72 return new XmlUnmarshallerRegistry(this);
73 }
74 }
75 }
76