![JAR search and dependency download from the Maven repository](/logo.png)
com.github.lwhite1.tablesaw.store.TableMetadata Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of tablesaw Show documentation
Show all versions of tablesaw Show documentation
High-performance Java Dataframe with integrated columnar storage
package com.github.lwhite1.tablesaw.store;
import com.github.lwhite1.tablesaw.table.Relation;
import com.github.lwhite1.tablesaw.columns.Column;
import com.google.gson.Gson;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
/**
* Data about a specific physical table used in it's persistence
*/
public class TableMetadata {
private static final Gson GSON = new Gson();
private final String name;
private final int rowCount;
private final List columnMetadataList = new ArrayList<>();
public TableMetadata(Relation table) {
this.name = table.name();
this.rowCount = table.rowCount();
for (Column column : table.columns()) {
columnMetadataList.add(new ColumnMetadata(column));
}
}
public String toJson() {
return GSON.toJson(this);
}
public static TableMetadata fromJson(String jsonString) {
return GSON.fromJson(jsonString, TableMetadata.class);
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
TableMetadata that = (TableMetadata) o;
return rowCount == that.rowCount &&
Objects.equals(name, that.name) &&
Objects.equals(columnMetadataList, that.columnMetadataList);
}
@Override
public int hashCode() {
return Objects.hash(name, rowCount, columnMetadataList);
}
public String getName() {
return name;
}
public int getRowCount() {
return rowCount;
}
public List getColumnMetadataList() {
return columnMetadataList;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy