public VersionInfo unmarshall(JsonUnmarshallerContext context) throws Exception { VersionInfo versionInfo = new VersionInfo(); 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("agentVersion", targetDepth)) { context.nextToken(); versionInfo.setAgentVersion(context.getUnmarshaller(String.class).unmarshall(context)); } if (context.testExpression("agentHash", targetDepth)) { context.nextToken(); versionInfo.setAgentHash(context.getUnmarshaller(String.class).unmarshall(context)); } if (context.testExpression("dockerVersion", targetDepth)) { context.nextToken(); versionInfo.setDockerVersion(context.getUnmarshaller(String.class).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 versionInfo; }
public Resource unmarshall(JsonUnmarshallerContext context) throws Exception { Resource resource = new Resource(); 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("name", targetDepth)) { context.nextToken(); resource.setName(context.getUnmarshaller(String.class).unmarshall(context)); } if (context.testExpression("type", targetDepth)) { context.nextToken(); resource.setType(context.getUnmarshaller(String.class).unmarshall(context)); } if (context.testExpression("doubleValue", targetDepth)) { context.nextToken(); resource.setDoubleValue(context.getUnmarshaller(Double.class).unmarshall(context)); } if (context.testExpression("longValue", targetDepth)) { context.nextToken(); resource.setLongValue(context.getUnmarshaller(Long.class).unmarshall(context)); } if (context.testExpression("integerValue", targetDepth)) { context.nextToken(); resource.setIntegerValue(context.getUnmarshaller(Integer.class).unmarshall(context)); } if (context.testExpression("stringSetValue", targetDepth)) { context.nextToken(); resource.setStringSetValue( new ListUnmarshaller<String>(context.getUnmarshaller(String.class)) .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 resource; }
public ContainerInstance unmarshall(JsonUnmarshallerContext context) throws Exception { ContainerInstance containerInstance = new ContainerInstance(); 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("containerInstanceArn", targetDepth)) { context.nextToken(); containerInstance.setContainerInstanceArn( context.getUnmarshaller(String.class).unmarshall(context)); } if (context.testExpression("ec2InstanceId", targetDepth)) { context.nextToken(); containerInstance.setEc2InstanceId( context.getUnmarshaller(String.class).unmarshall(context)); } if (context.testExpression("version", targetDepth)) { context.nextToken(); containerInstance.setVersion(context.getUnmarshaller(Long.class).unmarshall(context)); } if (context.testExpression("versionInfo", targetDepth)) { context.nextToken(); containerInstance.setVersionInfo( VersionInfoJsonUnmarshaller.getInstance().unmarshall(context)); } if (context.testExpression("remainingResources", targetDepth)) { context.nextToken(); containerInstance.setRemainingResources( new ListUnmarshaller<Resource>(ResourceJsonUnmarshaller.getInstance()) .unmarshall(context)); } if (context.testExpression("registeredResources", targetDepth)) { context.nextToken(); containerInstance.setRegisteredResources( new ListUnmarshaller<Resource>(ResourceJsonUnmarshaller.getInstance()) .unmarshall(context)); } if (context.testExpression("status", targetDepth)) { context.nextToken(); containerInstance.setStatus(context.getUnmarshaller(String.class).unmarshall(context)); } if (context.testExpression("agentConnected", targetDepth)) { context.nextToken(); containerInstance.setAgentConnected( context.getUnmarshaller(Boolean.class).unmarshall(context)); } if (context.testExpression("runningTasksCount", targetDepth)) { context.nextToken(); containerInstance.setRunningTasksCount( context.getUnmarshaller(Integer.class).unmarshall(context)); } if (context.testExpression("pendingTasksCount", targetDepth)) { context.nextToken(); containerInstance.setPendingTasksCount( context.getUnmarshaller(Integer.class).unmarshall(context)); } if (context.testExpression("agentUpdateStatus", targetDepth)) { context.nextToken(); containerInstance.setAgentUpdateStatus( context.getUnmarshaller(String.class).unmarshall(context)); } if (context.testExpression("attributes", targetDepth)) { context.nextToken(); containerInstance.setAttributes( new ListUnmarshaller<Attribute>(AttributeJsonUnmarshaller.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 containerInstance; }