本文整理匯總了Java中com.taobao.tddl.executor.record.CloneableRecord.get方法的典型用法代碼示例。如果您正苦於以下問題:Java CloneableRecord.get方法的具體用法?Java CloneableRecord.get怎麽用?Java CloneableRecord.get使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.taobao.tddl.executor.record.CloneableRecord
的用法示例。
在下文中一共展示了CloneableRecord.get方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: encode
import com.taobao.tddl.executor.record.CloneableRecord; //導入方法依賴的package包/類
@Override
public byte[] encode(CloneableRecord record) {
int length = calculateEncodedLength(record, columns);
byte[] dst = new byte[length];
int offset = 0;
for (ColumnMeta c : columns) {
Object v = record.get(c.getName());
DataType t = c.getDataType();
if (v == null && !c.isNullable()) {
throw new RuntimeException(c + " is not nullable.");
}
offset += t.encodeToBytes(v, dst, offset);
}
return dst;
}
示例2: encode
import com.taobao.tddl.executor.record.CloneableRecord; //導入方法依賴的package包/類
@Override
public byte[] encode(CloneableRecord record) {
int length = calculateEncodedLength(record, columns);
byte[] dst = new byte[length];
int offset = 0;
for (ColumnMeta c : columns) {
Object v = record.get(c.getName());
DataType t = c.getDataType();
if (v == null && !c.isNullable()) {
throw new RuntimeException(c + " is not nullable.");
}
offset += t.encodeToBytes(v, dst, offset);
// offset += encode1(v, t, dst, offset);
}
return dst;
}
示例3: calculateEncodedLength
import com.taobao.tddl.executor.record.CloneableRecord; //導入方法依賴的package包/類
private int calculateEncodedLength(CloneableRecord record, List<ColumnMeta> columns) {
int length = 0;
for (ColumnMeta c : columns) {
Object v = record.get(c.getName());
DataType t = c.getDataType();
length += t.getLength(v);
}
return length;
}
示例4: isEquals
import com.taobao.tddl.executor.record.CloneableRecord; //導入方法依賴的package包/類
@SuppressWarnings("unused")
private boolean isEquals(CloneableRecord right, CloneableRecord left) {
boolean equals = true;
List<String> leftColumns = left.getColumnList();
List<String> rightColumns = right.getColumnList();
Iterator<String> leftIter = leftColumns.iterator();
Iterator<String> rightIter = rightColumns.iterator();
while (leftIter.hasNext()) {
if (!rightIter.hasNext()) {
equals = false;
break;
} else {
String leftCol = leftIter.next();
String rightCol = rightIter.next();
Object leftVal = left.get(leftCol);
Object rightVal = right.get(rightCol);
if (leftVal != null && !leftVal.equals(rightVal)) {
equals = false;
break;
}
if (leftVal == null && rightVal != null) {
equals = false;
break;
}
}
}
// 如果左麵耗盡,右麵沒有耗盡,那麽也認為不等於。
if (rightIter.hasNext()) {
equals = false;
}
return equals;
}
示例5: get
import com.taobao.tddl.executor.record.CloneableRecord; //導入方法依賴的package包/類
public static Object get(ColumnMeta c, CloneableRecord r) {
return r.get(c.getTableName(), c.getName());
}
示例6: calculateEncodedLength
import com.taobao.tddl.executor.record.CloneableRecord; //導入方法依賴的package包/類
private int calculateEncodedLength(CloneableRecord record, List<ColumnMeta> columns) {
int length = 0;
for (ColumnMeta c : columns) {
Object v = record.get(c.getName());
DataType t = c.getDataType();
length += t.getLength(v);
// if (t == DATA_TYPE.LONG_VAL) {
// if (v == null) {
// length += 1;
// } else {
// length += 9;
// }
// } else if (t == DATA_TYPE.INT_VAL) {
// if (v == null) {
// length += 1;
// } else {
// length += 5;
// }
// } else if (t == DATA_TYPE.STRING_VAL) {
//
// if (v != null && !(v instanceof String)) {
// v = v.toString();
// }
// length += KeyEncoder.calculateEncodedStringLength((String) v);
// } else if (t == DATA_TYPE.FLOAT_VAL) {
// length += 4;
// } else if (t == DATA_TYPE.BYTES_VAL) {
// length += KeyEncoder.calculateEncodedLength((byte[]) v);
// } else if (t == DATA_TYPE.DATE_VAL || t ==
// DATA_TYPE.TIMESTAMP_VAL) {
// if (v == null) {
// length += 1;
// } else {
//
// length += 9;
// }
// } else {
// throw new RuntimeException("Column:" + c.getName() +
// " DATA_TYPE=" + t + "is not fixed length .");
// }
}
return length;
}