
api.DatabaseConnection Maven / Gradle / Ivy
package api;
import java.util.Objects;
/**
* Connects to a database
* @param The type of the schema the database has to fulfill.
* For an SQL database S should be an instance of SQLSchema.
*/
public interface DatabaseConnection {
class Value{
private final String value;
public Value(String value) {
assert value != null;
this.value = value;
}
public String get(){
return value;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
Value value1 = (Value) o;
return value.equals(value1.value);
}
@Override
public int hashCode() {
return Objects.hash(value);
}
@Override
public String toString() {
return "Value{" +
"value='" + value + '\'' +
'}';
}
}
/**
* Builds up the database according to the given schema.
* Data will be deleted, if it conflicts with the schema.
* @param schema The schema the database shall meet
* @param moreSchemas (Optional) additional schemas the database shall meet
*/
void init(S schema, S... moreSchemas);
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy