class BigQueryStrings {

  public static String toString(TableReference tableRef) {
    Preconditions.checkArgument(!Strings.isNullOrEmpty(tableRef.getDatasetId()),
        "tableRef must contain non-empty DatasetId.");
    Preconditions.checkArgument(!Strings.isNullOrEmpty(tableRef.getTableId()),
        "tableRef must contain non-empty TableId.");
    if (Strings.isNullOrEmpty(tableRef.getProjectId())) {
      return String.format("%s.%s", tableRef.getDatasetId(), tableRef.getTableId());
    } else {
      return String.format("%s:%s.%s",
          tableRef.getProjectId(), tableRef.getDatasetId(), tableRef.getTableId());
    }
  }

}