
com.amazonaws.protocol.json.SdkStructuredPlainJsonFactory Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of aws-java-sdk-osgi Show documentation
Show all versions of aws-java-sdk-osgi Show documentation
The AWS SDK for Java with support for OSGi. The AWS SDK for Java provides Java APIs for building software on AWS' cost-effective, scalable, and reliable infrastructure products. The AWS Java SDK allows developers to code against APIs for all of Amazon's infrastructure web services (Amazon S3, Amazon EC2, Amazon SQS, Amazon Relational Database Service, Amazon AutoScaling, etc).
/*
*
* Copyright (c) 2016 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 com.amazonaws.protocol.json;
import com.amazonaws.annotation.SdkInternalApi;
import com.amazonaws.annotation.SdkTestInternalApi;
import com.amazonaws.transform.JsonUnmarshallerContext;
import com.amazonaws.transform.SimpleTypeJsonUnmarshallers.BigDecimalJsonUnmarshaller;
import com.amazonaws.transform.SimpleTypeJsonUnmarshallers.BigIntegerJsonUnmarshaller;
import com.amazonaws.transform.SimpleTypeJsonUnmarshallers.BooleanJsonUnmarshaller;
import com.amazonaws.transform.SimpleTypeJsonUnmarshallers.ByteBufferJsonUnmarshaller;
import com.amazonaws.transform.SimpleTypeJsonUnmarshallers.ByteJsonUnmarshaller;
import com.amazonaws.transform.SimpleTypeJsonUnmarshallers.CharacterJsonUnmarshaller;
import com.amazonaws.transform.SimpleTypeJsonUnmarshallers.DateJsonUnmarshaller;
import com.amazonaws.transform.SimpleTypeJsonUnmarshallers.DoubleJsonUnmarshaller;
import com.amazonaws.transform.SimpleTypeJsonUnmarshallers.FloatJsonUnmarshaller;
import com.amazonaws.transform.SimpleTypeJsonUnmarshallers.IntegerJsonUnmarshaller;
import com.amazonaws.transform.SimpleTypeJsonUnmarshallers.LongJsonUnmarshaller;
import com.amazonaws.transform.SimpleTypeJsonUnmarshallers.ShortJsonUnmarshaller;
import com.amazonaws.transform.SimpleTypeJsonUnmarshallers.StringJsonUnmarshaller;
import com.amazonaws.transform.Unmarshaller;
import com.amazonaws.util.ImmutableMapParameter;
import com.fasterxml.jackson.core.JsonFactory;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.nio.ByteBuffer;
import java.util.Date;
import java.util.Map;
/**
* Creates generators and protocol handlers for plain text JSON wire format.
*/
@SdkInternalApi
public class SdkStructuredPlainJsonFactory {
/**
* Recommended to share JsonFactory instances per http://wiki.fasterxml
* .com/JacksonBestPracticesPerformance
*/
private static final JsonFactory JSON_FACTORY = new JsonFactory();
@SdkTestInternalApi
public static final Map, Unmarshaller, JsonUnmarshallerContext>> JSON_SCALAR_UNMARSHALLERS = new ImmutableMapParameter.Builder, Unmarshaller, JsonUnmarshallerContext>>()
.put(String.class, StringJsonUnmarshaller.getInstance())
.put(Double.class, DoubleJsonUnmarshaller.getInstance())
.put(Integer.class, IntegerJsonUnmarshaller.getInstance())
.put(BigInteger.class, BigIntegerJsonUnmarshaller.getInstance())
.put(BigDecimal.class, BigDecimalJsonUnmarshaller.getInstance())
.put(Boolean.class, BooleanJsonUnmarshaller.getInstance())
.put(Float.class, FloatJsonUnmarshaller.getInstance())
.put(Long.class, LongJsonUnmarshaller.getInstance())
.put(Byte.class, ByteJsonUnmarshaller.getInstance())
.put(Date.class, DateJsonUnmarshaller.getInstance())
.put(ByteBuffer.class, ByteBufferJsonUnmarshaller.getInstance())
.put(Character.class, CharacterJsonUnmarshaller.getInstance())
.put(Short.class, ShortJsonUnmarshaller.getInstance()).build();
public static final SdkStructuredJsonFactory SDK_JSON_FACTORY = new SdkStructuredJsonFactoryImpl(
JSON_FACTORY, JSON_SCALAR_UNMARSHALLERS) {
@Override
protected StructuredJsonGenerator createWriter(JsonFactory jsonFactory,
String contentType) {
return new SdkJsonGenerator(jsonFactory, contentType);
}
};
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy