public Row getRow()

in tablestore/src/main/java/com/alicloud/openservices/tablestore/model/SimpleRowMatrixBlockParser.java [271:318]


    public Row getRow() {
        List<PrimaryKeyColumn> pks = new ArrayList<PrimaryKeyColumn>(pkCount);
        parseFieldNames(); // ensure fieldNames not null
        for (int j = 0; j < pkCount; j++) {
            ColumnType type = getColumnType(j);
            switch (type) {
                case INTEGER:
                    pks.add(new PrimaryKeyColumn(fieldNames[j], PrimaryKeyValue.fromLong(getLong(j))));
                    break;
                case STRING:
                    pks.add(new PrimaryKeyColumn(fieldNames[j], PrimaryKeyValue.fromString(getString(j))));
                    break;
                case BINARY:
                    pks.add(new PrimaryKeyColumn(fieldNames[j], PrimaryKeyValue.fromBinary(getBinary(j))));
                    break;
                default:
                    throw new ClientException("Invalid ColumnType for PrimaryKeyType:" + type);
            }
        }
        List<Column> cols = new ArrayList<Column>(attrCount);
        for (int j = pkCount; j < fieldCount; j++) {
            ColumnType type = getColumnType(j);
            if (type == null) {
                // ignore null columns
                continue;
            }
            switch (type) {
                case INTEGER:
                    cols.add(new Column(fieldNames[j], ColumnValue.fromLong(getLong(j))));
                    break;
                case BOOLEAN:
                    cols.add(new Column(fieldNames[j], ColumnValue.fromBoolean(getBoolean(j))));
                    break;
                case DOUBLE:
                    cols.add(new Column(fieldNames[j], ColumnValue.fromDouble(getDouble(j))));
                    break;
                case STRING:
                    cols.add(new Column(fieldNames[j], ColumnValue.fromString(getString(j))));
                    break;
                case BINARY:
                    cols.add(new Column(fieldNames[j], ColumnValue.fromBinary(getBinary(j))));
                    break;
                default:
                    throw new ClientException("Invalid ColumnType:" + type);
            }
        }
        return new Row(new PrimaryKey(pks), cols);
    }