protected ColumnMetadata fromFieldDto(FieldDto fieldDto, TypeManager typeManager) { String type = fieldDto.getType(); if (type == null) { type = fieldDto.getSource_type(); } return new ColumnMetadata( fieldDto.getName(), typeConverter.get().toType(type, typeManager), fieldDto.isPartition_key(), fieldDto.getComment(), false); }
protected List<FieldDto> toFieldDtos(List<ColumnMetadata> columns) { List<FieldDto> result = Lists.newArrayList(); if (columns != null) { for (int i = 0; i < columns.size(); i++) { ColumnMetadata column = columns.get(i); FieldDto fieldDto = toFieldDto(column); if (column instanceof ColumnDetailMetadata) { ColumnDetailMetadata columnDetail = (ColumnDetailMetadata) column; fieldDto.setSource_type(columnDetail.getSourceType()); fieldDto.setIsNullable(columnDetail.getIsNullable()); fieldDto.setSize(columnDetail.getSize()); fieldDto.setDefaultValue(columnDetail.getDefaultValue()); fieldDto.setIsIndexKey(columnDetail.getIsIndexKey()); fieldDto.setIsSortKey(columnDetail.getIsSortKey()); } fieldDto.setPos(i); result.add(fieldDto); } } return result; }