Package com.enhancedechest.migration
Record Class SourceSpec
java.lang.Object
java.lang.Record
com.enhancedechest.migration.SourceSpec
- Record Components:
type- backend type:sqlite,mysql,mariadb,postgresorpostgresqlsqliteFile- SQLite database file (absolute, or relative to the plugin data folder); SQLite onlyhost- remote host; MySQL/MariaDB/PostgreSQL onlyport- remote port; MySQL/MariaDB/PostgreSQL onlydatabase- remote database name; MySQL/MariaDB/PostgreSQL onlyusername- remote username; MySQL/MariaDB/PostgreSQL onlypassword- remote password (shown in cleartext in the dialog — documented); MySQL/MariaDB/PostgreSQL only
public record SourceSpec(String type, String sqliteFile, String host, int port, String database, String username, String password)
extends Record
Connection details for the source database of a
/ee import DB→DB conversion, as filled
in by the import dialog. The destination is always the plugin's active backend; this describes the
old backend the admin is copying from.
Only the fields relevant to type are used: sqliteFile for SQLite, and
host/port/database/username/password for the remote engines.
The other fields are ignored (the dialog is static and shows every field regardless of type).
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiondatabase()Returns the value of thedatabaserecord component.final booleanIndicates whether some other object is "equal to" this one.static StringCollapses driver aliases to a family: mariadb→mysql, postgresql→postgres.final inthashCode()Returns a hash code value for this object.host()Returns the value of thehostrecord component.static StringBuilds the same identity string from raw parts (used for the active destination config too).A stable identity string for equality checks against the active destination, so an import that would read from the very database it is writing into can be refused.booleanisSqlite()True when this spec describes a file-based SQLite source.password()Returns the value of thepasswordrecord component.intport()Returns the value of theportrecord component.Returns the value of thesqliteFilerecord component.final StringtoString()Returns a string representation of this record class.type()Returns the value of thetyperecord component.username()Returns the value of theusernamerecord component.
-
Constructor Details
-
SourceSpec
public SourceSpec(String type, String sqliteFile, String host, int port, String database, String username, String password) Creates an instance of aSourceSpecrecord class.- Parameters:
type- the value for thetyperecord componentsqliteFile- the value for thesqliteFilerecord componenthost- the value for thehostrecord componentport- the value for theportrecord componentdatabase- the value for thedatabaserecord componentusername- the value for theusernamerecord componentpassword- the value for thepasswordrecord component
-
-
Method Details
-
isSqlite
public boolean isSqlite()True when this spec describes a file-based SQLite source. -
identity
A stable identity string for equality checks against the active destination, so an import that would read from the very database it is writing into can be refused. Two specs/backends pointing at the same database produce the same identity: for SQLite the absolute file path, otherwise the engine family plushost:port/database(host case-insensitive).- Parameters:
dataFolder- plugin data folder, used to resolve a relative SQLite file path
-
identity
public static String identity(String type, String sqliteFile, String host, int port, String database, Path dataFolder) Builds the same identity string from raw parts (used for the active destination config too). -
family
Collapses driver aliases to a family: mariadb→mysql, postgresql→postgres. -
toString
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
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. Reference components are compared withObjects::equals(Object,Object); primitive components are compared with '=='. -
type
Returns the value of thetyperecord component.- Returns:
- the value of the
typerecord component
-
sqliteFile
Returns the value of thesqliteFilerecord component.- Returns:
- the value of the
sqliteFilerecord component
-
host
Returns the value of thehostrecord component.- Returns:
- the value of the
hostrecord component
-
port
public int port()Returns the value of theportrecord component.- Returns:
- the value of the
portrecord component
-
database
Returns the value of thedatabaserecord component.- Returns:
- the value of the
databaserecord component
-
username
Returns the value of theusernamerecord component.- Returns:
- the value of the
usernamerecord component
-
password
Returns the value of thepasswordrecord component.- Returns:
- the value of the
passwordrecord component
-