@@ -101,6 +101,8 @@ protected static Connection getConnection() {
101
101
/**
102
102
* Find all the records for a corresponding domain model.
103
103
*
104
+ * @param clazz the record class.
105
+ * @param <T> the record type.
104
106
* @return all the domain model related records.
105
107
*/
106
108
public static <T extends RecordBase > List <T > findAll (Class <T > clazz ) {
@@ -126,7 +128,9 @@ public static <T extends RecordBase> List<T> findAll(Class<T> clazz) {
126
128
/**
127
129
* Find a domain model by its ID.
128
130
*
129
- * @param id domain model identifier.
131
+ * @param id domain model identifier.
132
+ * @param clazz the record class.
133
+ * @param <T> the record type.
130
134
* @return the domain model.
131
135
*/
132
136
public static <T extends RecordBase > Optional <T > findById (Long id , Class <T > clazz ) {
@@ -151,6 +155,13 @@ public static <T extends RecordBase> Optional<T> findById(Long id, Class<T> claz
151
155
}
152
156
}
153
157
158
+ /**
159
+ * Delete the record by its unique identifier.
160
+ *
161
+ * @param id the record identifier.
162
+ * @param clazz the record class.
163
+ * @param <T> the record type.
164
+ */
154
165
public static <T extends RecordBase > void delete (Long id , Class <T > clazz ) {
155
166
String deleteStatement = Query
156
167
.deleteFrom (getDeclaredClassInstance (clazz ).getTableName ())
@@ -168,6 +179,9 @@ public static <T extends RecordBase> void delete(Long id, Class<T> clazz) {
168
179
169
180
/**
170
181
* Save the record.
182
+ *
183
+ * @param clazz the record class.
184
+ * @param <T> the record type.
171
185
*/
172
186
public <T extends RecordBase > void save (Class <T > clazz ) {
173
187
try (Connection connection = getConnection ();
@@ -184,6 +198,13 @@ public <T extends RecordBase> void save(Class<T> clazz) {
184
198
185
199
protected abstract void setPreparedStatementParams (PreparedStatement pstmt ) throws SQLException ;
186
200
201
+ /**
202
+ * Constructs an insertion query based on the descending type's fields.
203
+ *
204
+ * @param clazz the record class.
205
+ * @param <T> the record type.
206
+ * @return a full insert query.
207
+ */
187
208
protected static <T extends RecordBase > String constructInsertionQuery (Class <T > clazz ) {
188
209
List <Object > arguments = new ArrayList <>();
189
210
try {
0 commit comments