software.amazon.awssdk.protocols.xml.internal.unmarshall.XmlPayloadUnmarshaller Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of aws-xml-protocol Show documentation
Show all versions of aws-xml-protocol Show documentation
The AWS SDK for Java - module holds the classes for AWS Xml protocol
The newest version!
/*
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file 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 software.amazon.awssdk.protocols.xml.internal.unmarshall;
import static java.util.Collections.singletonList;
import java.math.BigDecimal;
import java.time.Instant;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import software.amazon.awssdk.annotations.SdkInternalApi;
import software.amazon.awssdk.core.SdkBytes;
import software.amazon.awssdk.core.SdkField;
import software.amazon.awssdk.core.SdkPojo;
import software.amazon.awssdk.core.traits.ListTrait;
import software.amazon.awssdk.core.traits.MapTrait;
import software.amazon.awssdk.core.traits.TraitType;
import software.amazon.awssdk.protocols.core.StringToValueConverter;
import software.amazon.awssdk.protocols.query.unmarshall.XmlElement;
@SdkInternalApi
public final class XmlPayloadUnmarshaller {
public static final XmlUnmarshaller STRING = new SimpleTypePayloadUnmarshaller<>(StringToValueConverter.TO_STRING);
public static final XmlUnmarshaller INTEGER = new SimpleTypePayloadUnmarshaller<>(StringToValueConverter.TO_INTEGER);
public static final XmlUnmarshaller LONG = new SimpleTypePayloadUnmarshaller<>(StringToValueConverter.TO_LONG);
public static final XmlUnmarshaller SHORT = new SimpleTypePayloadUnmarshaller<>(StringToValueConverter.TO_SHORT);
public static final XmlUnmarshaller FLOAT = new SimpleTypePayloadUnmarshaller<>(StringToValueConverter.TO_FLOAT);
public static final XmlUnmarshaller DOUBLE = new SimpleTypePayloadUnmarshaller<>(StringToValueConverter.TO_DOUBLE);
public static final XmlUnmarshaller BIG_DECIMAL =
new SimpleTypePayloadUnmarshaller<>(StringToValueConverter.TO_BIG_DECIMAL);
public static final XmlUnmarshaller BOOLEAN = new SimpleTypePayloadUnmarshaller<>(StringToValueConverter.TO_BOOLEAN);
public static final XmlUnmarshaller INSTANT =
new SimpleTypePayloadUnmarshaller<>(XmlProtocolUnmarshaller.INSTANT_STRING_TO_VALUE);
public static final XmlUnmarshaller SDK_BYTES =
new SimpleTypePayloadUnmarshaller<>(StringToValueConverter.TO_SDK_BYTES);
private XmlPayloadUnmarshaller() {
}
public static SdkPojo unmarshallSdkPojo(XmlUnmarshallerContext context, List content, SdkField field) {
return context.protocolUnmarshaller()
.unmarshall(context, field.constructor().get(), content.get(0));
}
public static List> unmarshallList(XmlUnmarshallerContext context, List content, SdkField> field) {
ListTrait listTrait = field.getTrait(ListTrait.class, TraitType.LIST_TRAIT);
List