Record Class Database
java.lang.Object
java.lang.Record
io.bloviate.db.Database
- Record Components:
product- the database product name (e.g., "PostgreSQL", "MySQL")productVersion- the version string of the database productcatalog- the catalog name, may be null for databases that don't use catalogsschema- the schema name, may be null for databases that don't use schemastables- the list of tables contained in this database
public record Database(String product, String productVersion, String catalog, String schema, List<Table> tables)
extends Record
Represents a database instance with its metadata and contained tables.
This immutable record encapsulates database-level information including the database product name, version, catalog, schema, and all tables within the database. It provides convenient access to tables by name with case-insensitive lookup.
Database instances are typically created by DatabaseUtils
when analyzing database metadata through JDBC.
- Author:
- Tim Veil
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncatalog()Returns the value of thecatalogrecord component.final booleanIndicates whether some other object is "equal to" this one.Retrieves a table by name using case-insensitive comparison.final inthashCode()Returns a hash code value for this object.product()Returns the value of theproductrecord component.Returns the value of theproductVersionrecord component.schema()Returns the value of theschemarecord component.tables()Returns the value of thetablesrecord component.final StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
Database
public Database(String product, String productVersion, String catalog, String schema, List<Table> tables) Creates an instance of aDatabaserecord class.- Parameters:
product- the value for theproductrecord componentproductVersion- the value for theproductVersionrecord componentcatalog- the value for thecatalogrecord componentschema- the value for theschemarecord componenttables- the value for thetablesrecord component
-
-
Method Details
-
getTable
Retrieves a table by name using case-insensitive comparison.- Parameters:
tableName- the name of the table to find- Returns:
- the table with the specified name
- Throws:
IllegalArgumentException- if no table with the given name exists
-
toString
-
hashCode
-
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared withObjects::equals(Object,Object). -
product
-
productVersion
Returns the value of theproductVersionrecord component.- Returns:
- the value of the
productVersionrecord component
-
catalog
-
schema
-
tables
-