text:
package com.amazonaws.services.kendra.model.transform;

import java.math.*;

import javax.annotation.Generated;

import com.amazonaws.services.kendra.model.*;
import com.amazonaws.transform.SimpleTypeJsonUnmarshallers.*;
import com.amazonaws.transform.*;

import com.fasterxml.jackson.core.JsonToken;
import static com.fasterxml.jackson.core.JsonToken.*;

/**
 * DocumentAttributeValueCountPair JSON Unmarshaller
 */
@Generated("com.amazonaws:aws-java-sdk-code-generator")
public class DocumentAttributeValueCountPairJsonUnmarshaller implements Unmarshaller<DocumentAttributeValueCountPair, JsonUnmarshallerContext> {

    public DocumentAttributeValueCountPair unmarshall(JsonUnmarshallerContext context) throws Exception {
        DocumentAttributeValueCountPair documentAttributeValueCountPair = new DocumentAttributeValueCountPair();

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

        JsonToken token = context.getCurrentToken();
        if (token == null)
            token = context.nextToken();
        if (token == VALUE_NULL) {
            return null;
        }

        while (true) {
            if (token == null)
                break;

            if (token == FIELD_NAME || token == START_OBJECT) {
                if (context.testExpression("DocumentAttributeValue", targetDepth)) {
                    context.nextToken();
                    documentAttributeValueCountPair.setDocumentAttributeValue(DocumentAttributeValueJsonUnmarshaller.getInstance().unmarshall(context));
                }
                if (context.testExpression("Count", targetDepth)) {
                    context.nextToken();
                    documentAttributeValueCountPair.setCount(context.getUnmarshaller(Integer.class).unmarshall(context));
                }
                if (context.testExpression("FacetResults", targetDepth)) {
                    context.nextToken();
                    documentAttributeValueCountPair.setFacetResults(new ListUnmarshaller<FacetResult>(FacetResultJsonUnmarshaller.getInstance())

                    .unmarshall(context));
                }
            } else if (token == END_ARRAY || token == END_OBJECT) {
                if (context.getLastParsedParentElement() == null || context.getLastParsedParentElement().equals(currentParentElement)) {
                    if (context.getCurrentDepth() <= originalDepth)
                        break;
                }
            }
            token = context.nextToken();
        }

        return documentAttributeValueCountPair;
    }

    private static DocumentAttributeValueCountPairJsonUnmarshaller instance;

    public static DocumentAttributeValueCountPairJsonUnmarshaller getInstance() {
        if (instance == null)
            instance = new DocumentAttributeValueCountPairJsonUnmarshaller();
        return instance;
    }
}