
com.aliyun.openservices.ots.model.Row Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of ots-public Show documentation
Show all versions of ots-public Show documentation
Aliyun Open Services SDK for Java Copyright (C) Alibaba Cloud Computing All rights reserved. 版权所有 (C)阿里云计算有限公司 http://www.aliyun.com
package com.aliyun.openservices.ots.model;
import com.aliyun.openservices.ots.ClientException;
import com.aliyun.openservices.ots.OTSException;
import java.util.*;
/**
* 表示查询时返回的数据行。
*
* {@link Row#getColumns()}包含了查询时指定的返回列,可能有主键列也可能有属性列。
* 如果查询时没有指定返回列,则包含有整行所有列的数据。
*
*/
public class Row {
private SortedMap columns =
new TreeMap(); // 行中的列
/**
* 获取列(Column)名称与值的只读对应字典。
* @return 列(Column)名称与值的只读对应字典。
* @throws ClientException 解码列值失败。
*/
public Map getColumns() throws ClientException {
return Collections.unmodifiableMap(columns);
}
/**
* 获取列(Column)名称与值的只读对应字典,字典中的列按名称进行排序。
*
* @return 列(Column)名称与值的只读对应字典。
* @throws ClientException 解码列值失败。
*/
public SortedMap getSortedColumns() throws ClientException {
return Collections.unmodifiableSortedMap(columns);
}
/**
* internal use
*/
public Row(){
}
/**
* internal use
*/
public void addColumn(String name, ColumnValue value) {
columns.put(name, value);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append('[');
boolean first = true;
for (Map.Entry entry : columns.entrySet()) {
if (first) {
first = false;
} else {
sb.append(", ");
}
sb.append(entry.getKey()).append(':').append(entry.getValue().toString());
}
sb.append(']');
return sb.toString();
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy