@@ -29,35 +29,13 @@ protected AliasableSqlTable(String tableName, Supplier<T> constructor) {
29
29
this .constructor = Objects .requireNonNull (constructor );
30
30
}
31
31
32
- protected AliasableSqlTable (Supplier <String > tableNameSupplier , Supplier <T > constructor ) {
33
- super (tableNameSupplier );
34
- this .constructor = Objects .requireNonNull (constructor );
35
- }
36
-
37
32
public T withAlias (String alias ) {
38
33
T newTable = constructor .get ();
39
34
((AliasableSqlTable <T >) newTable ).tableAlias = alias ;
40
35
newTable .nameSupplier = nameSupplier ;
41
36
return newTable ;
42
37
}
43
38
44
- /**
45
- * Returns a new instance of this table with the specified name supplier. All column instances are recreated.
46
- * This is useful for sharding where the table name may change at runtime based on some sharding algorithm,
47
- * but all other table attributes are the same. Use of a name supplier allows you to create one table
48
- * instance with a dynamically changing table name. Be very careful with this usage - it is NOT
49
- * thread safe unless the specified nameSupplier is thread safe.
50
- *
51
- * @param nameSupplier new name supplier for the table
52
- * @return a new AliasableSqlTable with the specified nameSupplier, all other table attributes are copied
53
- */
54
- public T withNameSupplier (Supplier <String > nameSupplier ) {
55
- T newTable = constructor .get ();
56
- ((AliasableSqlTable <T >) newTable ).tableAlias = tableAlias ;
57
- newTable .nameSupplier = Objects .requireNonNull (nameSupplier );
58
- return newTable ;
59
- }
60
-
61
39
/**
62
40
* Returns a new instance of this table with the specified name. All column instances are recreated.
63
41
* This is useful for sharding where the table name may change at runtime based on some sharding algorithm,
@@ -68,7 +46,10 @@ public T withNameSupplier(Supplier<String> nameSupplier) {
68
46
*/
69
47
public T withName (String name ) {
70
48
Objects .requireNonNull (name );
71
- return withNameSupplier (() -> name );
49
+ T newTable = constructor .get ();
50
+ ((AliasableSqlTable <T >) newTable ).tableAlias = tableAlias ;
51
+ newTable .nameSupplier = () -> name ;
52
+ return newTable ;
72
53
}
73
54
74
55
@ Override
0 commit comments