1515 */
1616package org .springframework .data .cassandra .core ;
1717
18+ import java .util .Collections ;
1819import java .util .Map ;
1920import java .util .Optional ;
2021
@@ -43,32 +44,46 @@ public interface CassandraAdminOperations extends CassandraOperations {
4344 SchemaFactory getSchemaFactory ();
4445
4546 /**
46- * Create a table with the name given and fields corresponding to the given class. If the table already exists and
47- * parameter {@code ifNotExists} is {@literal true}, this is a no-op and {@literal false} is returned. If the table
48- * doesn't exist, parameter {@code ifNotExists} is ignored, the table is created and {@literal true} is returned.
47+ * Create a table with the name, that is derived from the given {@code entityClass} and also fields corresponding to
48+ * the same class. If the table already exists and parameter {@code ifNotExists} is {@literal true}, this is a no-op
49+ * and {@literal false} is returned. If the table doesn't exist, parameter {@code ifNotExists} is ignored, the table
50+ * is created and {@literal true} is returned.
4951 *
50- * @param ifNotExists If true, will only create the table if it doesn't exist, else the create operation will be
51- * ignored.
52- * @param tableName The name of the table.
53- * @param entityClass The class whose fields determine the columns created.
54- * @param optionsByName Table options, given by the string option name and the appropriate option value.
52+ * @param ifNotExists if {@code true}, create the table only if it doesn't exist.
53+ * @param entityClass the class whose fields determine the columns created.
54+ * @since 4.2
5555 */
56- void createTable (boolean ifNotExists , CqlIdentifier tableName , Class <?> entityClass ,
57- Map <String , Object > optionsByName );
56+ default void createTable (boolean ifNotExists , Class <?> entityClass ) {
57+ createTable (ifNotExists , entityClass , Collections .emptyMap ());
58+ }
5859
5960 /**
60- * Create a table with the name, that is derived from the given {@code entityClass} and also fields corresponding to the
61- * same class. If the table already exists and parameter {@code ifNotExists} is {@literal true}, this is a no-op and
62- * {@literal false} is returned. If the table doesn't exist, parameter {@code ifNotExists} is ignored, the table is created
63- * and {@literal true} is returned.
61+ * Create a table with the name, that is derived from the given {@code entityClass} and also fields corresponding to
62+ * the same class. If the table already exists and parameter {@code ifNotExists} is {@literal true}, this is a no-op
63+ * and {@literal false} is returned. If the table doesn't exist, parameter {@code ifNotExists} is ignored, the table
64+ * is created and {@literal true} is returned.
6465 *
65- * @param ifNotExists If true, will only create the table if it doesn't exist, else the create operation will be
66- * ignored .
67- * @param entityClass The class whose fields determine the columns created .
68- * @param optionsByName Table options, given by the string option name and the appropriate option value.
66+ * @param ifNotExists if {@code true}, create the table only if it doesn't exist.
67+ * @param entityClass the class whose fields determine the columns created .
68+ * @param optionsByName table options, given by the string option name and the appropriate option value .
69+ * @since 4.2
6970 */
70- void createTable (boolean ifNotExists , Class <?> entityClass , Map <String , Object > optionsByName );
71+ default void createTable (boolean ifNotExists , Class <?> entityClass , Map <String , Object > optionsByName ) {
72+ createTable (ifNotExists , getTableName (entityClass ), entityClass , optionsByName );
73+ }
7174
75+ /**
76+ * Create a table with the name given and fields corresponding to the given class. If the table already exists and
77+ * parameter {@code ifNotExists} is {@literal true}, this is a no-op and {@literal false} is returned. If the table
78+ * doesn't exist, parameter {@code ifNotExists} is ignored, the table is created and {@literal true} is returned.
79+ *
80+ * @param ifNotExists if {@code true}, create the table only if it doesn't exist.
81+ * @param tableName the name of the table.
82+ * @param entityClass the class whose fields determine the columns created.
83+ * @param optionsByName table options, given by the string option name and the appropriate option value.
84+ */
85+ void createTable (boolean ifNotExists , CqlIdentifier tableName , Class <?> entityClass ,
86+ Map <String , Object > optionsByName );
7287
7388 /**
7489 * Drops a table based on the given {@link Class entity type}. The name of the table is derived from either the simple
@@ -89,7 +104,7 @@ void createTable(boolean ifNotExists, CqlIdentifier tableName, Class<?> entityCl
89104 /**
90105 * Drops the {@link String named} table.
91106 *
92- * @param ifExists If {@literal true}, will only drop the table if it exists, else the drop operation will be ignored .
107+ * @param ifExists if {@code true}, drop the table only if it exists.
93108 * @param tableName {@link String Name} of the table to drop.
94109 * @since 2.1
95110 */
0 commit comments