15
15
*/
16
16
package org .springframework .data .cassandra .core ;
17
17
18
+ import java .util .Collections ;
18
19
import java .util .Map ;
19
20
import java .util .Optional ;
20
21
@@ -43,32 +44,46 @@ public interface CassandraAdminOperations extends CassandraOperations {
43
44
SchemaFactory getSchemaFactory ();
44
45
45
46
/**
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.
49
51
*
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
55
55
*/
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
+ }
58
59
59
60
/**
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.
64
65
*
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
69
70
*/
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
+ }
71
74
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 );
72
87
73
88
/**
74
89
* 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
89
104
/**
90
105
* Drops the {@link String named} table.
91
106
*
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.
93
108
* @param tableName {@link String Name} of the table to drop.
94
109
* @since 2.1
95
110
*/
0 commit comments