public Shard unmarshall(JsonUnmarshallerContext context) throws Exception { Shard shard = new Shard(); int originalDepth = context.getCurrentDepth(); String currentParentElement = context.getCurrentParentElement(); int targetDepth = originalDepth + 1; JsonToken token = context.currentToken; 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("ShardId", targetDepth)) { context.nextToken(); shard.setShardId(StringJsonUnmarshaller.getInstance().unmarshall(context)); } if (context.testExpression("ParentShardId", targetDepth)) { context.nextToken(); shard.setParentShardId(StringJsonUnmarshaller.getInstance().unmarshall(context)); } if (context.testExpression("AdjacentParentShardId", targetDepth)) { context.nextToken(); shard.setAdjacentParentShardId(StringJsonUnmarshaller.getInstance().unmarshall(context)); } if (context.testExpression("HashKeyRange", targetDepth)) { context.nextToken(); shard.setHashKeyRange(HashKeyRangeJsonUnmarshaller.getInstance().unmarshall(context)); } if (context.testExpression("SequenceNumberRange", targetDepth)) { context.nextToken(); shard.setSequenceNumberRange( SequenceNumberRangeJsonUnmarshaller.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 shard; }
public DescribeStreamResult unmarshall(JsonUnmarshallerContext context) throws Exception { DescribeStreamResult describeStreamResult = new DescribeStreamResult(); 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("StreamDescription", targetDepth)) { context.nextToken(); describeStreamResult.setStreamDescription( StreamDescriptionJsonUnmarshaller.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 describeStreamResult; }
public Record unmarshall(JsonUnmarshallerContext context) throws Exception { Record record = new Record(); 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("SequenceNumber", targetDepth)) { context.nextToken(); record.setSequenceNumber(context.getUnmarshaller(String.class).unmarshall(context)); } if (context.testExpression("ApproximateArrivalTimestamp", targetDepth)) { context.nextToken(); record.setApproximateArrivalTimestamp( context.getUnmarshaller(java.util.Date.class).unmarshall(context)); } if (context.testExpression("Data", targetDepth)) { context.nextToken(); record.setData(context.getUnmarshaller(java.nio.ByteBuffer.class).unmarshall(context)); } if (context.testExpression("PartitionKey", targetDepth)) { context.nextToken(); record.setPartitionKey(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 record; }