Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  /*
   * Copyright 2010-2015 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.services.ecs.model.transform;
 
 import java.util.Map;
 
 
 import static com.fasterxml.jackson.core.JsonToken.*;

Container Definition JSON Unmarshaller
 
 
     public ContainerDefinition unmarshall(JsonUnmarshallerContext contextthrows Exception {
         ContainerDefinition containerDefinition = new ContainerDefinition();
 
         int originalDepth = context.getCurrentDepth();
         String currentParentElement = context.getCurrentParentElement();
         int targetDepth = originalDepth + 1;
 
         JsonToken token = context.getCurrentToken();
         if (token == nulltoken = context.nextToken();
         if (token == return null;
 
         while (true) {
             if (token == nullbreak;
 
             if (token ==  || token == ) {
                 if (context.testExpression("name"targetDepth)) {
                     context.nextToken();
                     containerDefinition.setName(StringJsonUnmarshaller.getInstance().unmarshall(context));
                 }
                 if (context.testExpression("image"targetDepth)) {
                     context.nextToken();
                     containerDefinition.setImage(StringJsonUnmarshaller.getInstance().unmarshall(context));
                 }
                 if (context.testExpression("cpu"targetDepth)) {
                     context.nextToken();
                     containerDefinition.setCpu(IntegerJsonUnmarshaller.getInstance().unmarshall(context));
                 }
                 if (context.testExpression("memory"targetDepth)) {
                     context.nextToken();
                     containerDefinition.setMemory(IntegerJsonUnmarshaller.getInstance().unmarshall(context));
                 }
                 if (context.testExpression("links"targetDepth)) {
                     context.nextToken();
                     containerDefinition.setLinks(new ListUnmarshaller<String>(StringJsonUnmarshaller.getInstance()).unmarshall(context));
                 }
                 if (context.testExpression("portMappings"targetDepth)) {
                     context.nextToken();
                     containerDefinition.setPortMappings(new ListUnmarshaller<PortMapping>(PortMappingJsonUnmarshaller.getInstance()).unmarshall(context));
                 }
                 if (context.testExpression("essential"targetDepth)) {
                     context.nextToken();
                     containerDefinition.setEssential(BooleanJsonUnmarshaller.getInstance().unmarshall(context));
                 }
                 if (context.testExpression("entryPoint"targetDepth)) {
                     context.nextToken();
                     containerDefinition.setEntryPoint(new ListUnmarshaller<String>(StringJsonUnmarshaller.getInstance()).unmarshall(context));
                 }
                 if (context.testExpression("command"targetDepth)) {
                     context.nextToken();
                     containerDefinition.setCommand(new ListUnmarshaller<String>(StringJsonUnmarshaller.getInstance()).unmarshall(context));
                 }
                 if (context.testExpression("environment"targetDepth)) {
                     context.nextToken();
                     containerDefinition.setEnvironment(new ListUnmarshaller<KeyValuePair>(KeyValuePairJsonUnmarshaller.getInstance()).unmarshall(context));
                 }
                 if (context.testExpression("mountPoints"targetDepth)) {
                     context.nextToken();
                     containerDefinition.setMountPoints(new ListUnmarshaller<MountPoint>(MountPointJsonUnmarshaller.getInstance()).unmarshall(context));
                 }
                 if (context.testExpression("volumesFrom"targetDepth)) {
                     context.nextToken();
                     containerDefinition.setVolumesFrom(new ListUnmarshaller<VolumeFrom>(VolumeFromJsonUnmarshaller.getInstance()).unmarshall(context));
                 }
             } else if (token ==  || token == ) {
                 if (context.getLastParsedParentElement() == null || context.getLastParsedParentElement().equals(currentParentElement)) {
                     if (context.getCurrentDepth() <= originalDepthbreak;
                 }
            }
            token = context.nextToken();
        }
        
        return containerDefinition;
    }
        if ( == null = new ContainerDefinitionJsonUnmarshaller();
        return ;
    }
}
    
New to GrepCode? Check out our FAQ X