Query<T : Status>( val column: String, val tableName: String, val predicate: String) { companion object { fun select(column: String) = Query<Status.From>(column, "", "") } } fun Query<Status.From>.from(tableName: String) = Query<Status.Where>(this.column, tableName, this.predicate) fun Query<Status.Where>.where(predicate: String) = Query<Status.Print>(this.column, this.tableName, predicate) fun Query<Status.Print>.print() = "SELECT $column FROM $tableName WHERE $predicate ;" Query<Status.Print>型 からしか呼び出せない