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 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.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("SequenceNumber", targetDepth)) {
          context.nextToken();
          record.setSequenceNumber(StringJsonUnmarshaller.getInstance().unmarshall(context));
        }
        if (context.testExpression("Data", targetDepth)) {
          context.nextToken();
          record.setData(ByteBufferJsonUnmarshaller.getInstance().unmarshall(context));
        }
        if (context.testExpression("PartitionKey", targetDepth)) {
          context.nextToken();
          record.setPartitionKey(StringJsonUnmarshaller.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 record;
  }