use of com.palantir.atlasdb.table.description.NamedColumnDescription in project atlasdb by palantir.
the class TableClassRendererV2 method renderNamedDelete.
private List<MethodSpec> renderNamedDelete() {
List<MethodSpec> deleteResults = new ArrayList<>();
deleteResults.add(renderNamedDeleteRow());
for (NamedColumnDescription col : ColumnRenderers.namedColumns(tableMetadata)) {
deleteResults.add(renderNamedDeleteColumn(col));
}
return deleteResults;
}
use of com.palantir.atlasdb.table.description.NamedColumnDescription in project atlasdb by palantir.
the class TableClassRendererV2 method renderNamedDeleteRow.
private MethodSpec renderNamedDeleteRow() {
MethodSpec.Builder deleteRowBuilder = MethodSpec.methodBuilder("deleteRow").addModifiers(Modifier.PUBLIC).addJavadoc("Delete all columns for specified row components.");
deleteRowBuilder = addParametersFromRowComponents(deleteRowBuilder, tableMetadata);
SortedSet<NamedColumnDescription> namedColumns = ColumnRenderers.namedColumns(tableMetadata);
deleteRowBuilder.addStatement("$T row = $T.of($L)", rowType, rowType, getArgumentsFromRowComponents(tableMetadata)).addStatement("byte[] rowBytes = row.persistToBytes()", Persistables.class).addStatement("$T<$T> cells = $T.newHashSetWithExpectedSize($L)", Set.class, Cell.class, Sets.class, namedColumns.size());
for (NamedColumnDescription col : namedColumns) {
deleteRowBuilder.addStatement("cells.add($T.create(rowBytes, $T.toCachedBytes($L)))", Cell.class, PtBytes.class, ColumnRenderers.short_name(col));
}
deleteRowBuilder.addStatement("t.delete(tableRef, cells)");
return deleteRowBuilder.build();
}
use of com.palantir.atlasdb.table.description.NamedColumnDescription in project atlasdb by palantir.
the class TableClassRendererV2 method renderNamedGet.
private List<MethodSpec> renderNamedGet() {
List<MethodSpec> getterResults = new ArrayList<>();
for (NamedColumnDescription col : ColumnRenderers.namedColumns(tableMetadata)) {
getterResults.add(renderNamedGetColumn(col));
if (tableMetadata.getRowMetadata().getRowParts().size() == 1) {
getterResults.add(renderNamedGetSeveralRows(col));
if (tableMetadata.isRangeScanAllowed()) {
getterResults.add(renderNamedGetRangeColumn(col));
getterResults.add(renderNamedGetRangeStartEnd(col));
getterResults.add(renderNamedGetRangeColumnLimit(col));
}
} else {
getterResults.add(renderNamedGetSeveralRowObjects(col));
if (tableMetadata.isRangeScanAllowed()) {
getterResults.add(renderNamedGetRangeColumnRowObjects(col));
getterResults.add(renderNamedGetRangeColumnRowObjectsLimit(col));
}
}
}
return getterResults;
}
Aggregations