Skip to content

Commit 8deb494

Browse files
committed
Simplify SqlTable
1 parent 414f98d commit 8deb494

File tree

2 files changed

+5
-8
lines changed

2 files changed

+5
-8
lines changed

src/main/java/org/mybatis/dynamic/sql/AliasableSqlTable.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ protected AliasableSqlTable(String tableName, Supplier<T> constructor) {
3232
public T withAlias(String alias) {
3333
T newTable = constructor.get();
3434
((AliasableSqlTable<T>) newTable).tableAlias = alias;
35-
newTable.nameSupplier = nameSupplier;
35+
newTable.tableName = tableName;
3636
return newTable;
3737
}
3838

@@ -48,7 +48,7 @@ public T withName(String name) {
4848
Objects.requireNonNull(name);
4949
T newTable = constructor.get();
5050
((AliasableSqlTable<T>) newTable).tableAlias = tableAlias;
51-
newTable.nameSupplier = () -> name;
51+
newTable.tableName = name;
5252
return newTable;
5353
}
5454

src/main/java/org/mybatis/dynamic/sql/SqlTable.java

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,22 +18,19 @@
1818
import java.sql.JDBCType;
1919
import java.util.Objects;
2020
import java.util.Optional;
21-
import java.util.function.Supplier;
2221

2322
import org.jetbrains.annotations.NotNull;
2423

2524
public class SqlTable implements TableExpression {
2625

27-
protected Supplier<String> nameSupplier;
26+
protected String tableName;
2827

2928
protected SqlTable(String tableName) {
30-
Objects.requireNonNull(tableName);
31-
32-
this.nameSupplier = () -> tableName;
29+
this.tableName = Objects.requireNonNull(tableName);
3330
}
3431

3532
public String tableNameAtRuntime() {
36-
return nameSupplier.get();
33+
return tableName;
3734
}
3835

3936
public BasicColumn allColumns() {

0 commit comments

Comments
 (0)