Package com.amazonaws.services.dynamodb.model.transform

Source Code of com.amazonaws.services.dynamodb.model.transform.ProvisionedThroughputJsonUnmarshaller

package com.amazonaws.services.dynamodb.model.transform;

import com.amazonaws.services.dynamodb.model.ProvisionedThroughput;
import com.amazonaws.transform.JsonUnmarshallerContext;
import com.amazonaws.transform.SimpleTypeJsonUnmarshallers;
import com.amazonaws.transform.Unmarshaller;
import com.fasterxml.jackson.core.JsonToken;


public class ProvisionedThroughputJsonUnmarshaller implements Unmarshaller<ProvisionedThroughput, JsonUnmarshallerContext> {

    public ProvisionedThroughput unmarshall(JsonUnmarshallerContext context) throws Exception {
        ProvisionedThroughput request = new ProvisionedThroughput();

        int originalDepth = context.getCurrentDepth();
        int targetDepth = originalDepth + 1;

        JsonToken token = context.currentToken;
        if (token == null) token = context.nextToken();

       while (true) {
            if (token == null) break;
            if (token == JsonToken.FIELD_NAME || token == JsonToken.START_OBJECT) {
              if (context.testExpression("ReadCapacityUnits", targetDepth)) {
                    context.nextToken();
                    request.setReadCapacityUnits(SimpleTypeJsonUnmarshallers.LongJsonUnmarshaller.getInstance().unmarshall(context));
                }
                if (context.testExpression("WriteCapacityUnits", targetDepth)) {
                    context.nextToken();
                    request.setWriteCapacityUnits(SimpleTypeJsonUnmarshallers.LongJsonUnmarshaller.getInstance().unmarshall(context));
                }
            } else if (token == JsonToken.END_ARRAY || token == JsonToken.END_OBJECT) {
                if (context.getCurrentDepth() <= originalDepth) break;
            }
            token = context.nextToken();
        }

        return request;
    }

    private static ProvisionedThroughputJsonUnmarshaller instance;
    public static ProvisionedThroughputJsonUnmarshaller getInstance() {
        if (instance == null) instance = new ProvisionedThroughputJsonUnmarshaller();
        return instance;
    }
}
TOP

Related Classes of com.amazonaws.services.dynamodb.model.transform.ProvisionedThroughputJsonUnmarshaller

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.