Skip to content

Commit 74ec2e1

Browse files
committed
reverted breaking naming change
1 parent 3080abc commit 74ec2e1

File tree

9 files changed

+85
-85
lines changed

9 files changed

+85
-85
lines changed

spring-data-jdbc/src/main/java/org/springframework/data/jdbc/core/JdbcAggregateChangeExecutionContext.java

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ class JdbcAggregateChangeExecutionContext {
7373

7474
<T> void executeInsertRoot(DbAction.InsertRoot<T> insert) {
7575

76-
Object id = accessStrategy.insert(insert.entity(), insert.entityType(), Identifier.empty(),
76+
Object id = accessStrategy.insert(insert.entity(), insert.getEntityType(), Identifier.empty(),
7777
insert.idValueSource());
7878
add(new DbActionExecutionResult(insert, id));
7979
}
@@ -84,7 +84,7 @@ <T> void executeBatchInsertRoot(DbAction.BatchInsertRoot<T> batchInsertRoot) {
8484
List<InsertSubject<T>> insertSubjects = inserts.stream()
8585
.map(insert -> InsertSubject.describedBy(insert.entity(), Identifier.empty())).collect(Collectors.toList());
8686

87-
Object[] ids = accessStrategy.insert(insertSubjects, batchInsertRoot.entityType(),
87+
Object[] ids = accessStrategy.insert(insertSubjects, batchInsertRoot.getEntityType(),
8888
batchInsertRoot.getBatchValue());
8989

9090
for (int i = 0; i < inserts.size(); i++) {
@@ -95,7 +95,7 @@ <T> void executeBatchInsertRoot(DbAction.BatchInsertRoot<T> batchInsertRoot) {
9595
<T> void executeInsert(DbAction.Insert<T> insert) {
9696

9797
Identifier parentKeys = getParentKeys(insert, converter);
98-
Object id = accessStrategy.insert(insert.entity(), insert.entityType(), parentKeys,
98+
Object id = accessStrategy.insert(insert.entity(), insert.getEntityType(), parentKeys,
9999
insert.idValueSource());
100100
add(new DbActionExecutionResult(insert, id));
101101
}
@@ -107,7 +107,7 @@ <T> void executeBatchInsert(DbAction.BatchInsert<T> batchInsert) {
107107
.map(insert -> InsertSubject.describedBy(insert.entity(), getParentKeys(insert, converter)))
108108
.collect(Collectors.toList());
109109

110-
Object[] ids = accessStrategy.insert(insertSubjects, batchInsert.entityType(), batchInsert.getBatchValue());
110+
Object[] ids = accessStrategy.insert(insertSubjects, batchInsert.getEntityType(), batchInsert.getBatchValue());
111111

112112
for (int i = 0; i < inserts.size(); i++) {
113113
add(new DbActionExecutionResult(inserts.get(i), ids.length > 0 ? ids[i] : null));
@@ -127,16 +127,16 @@ <T> void executeUpdateRoot(DbAction.UpdateRoot<T> update) {
127127
<T> void executeDeleteRoot(DbAction.DeleteRoot<T> delete) {
128128

129129
if (delete.previousVersion() != null) {
130-
accessStrategy.deleteWithVersion(delete.id(), delete.entityType(), delete.previousVersion());
130+
accessStrategy.deleteWithVersion(delete.id(), delete.getEntityType(), delete.previousVersion());
131131
} else {
132-
accessStrategy.delete(delete.id(), delete.entityType());
132+
accessStrategy.delete(delete.id(), delete.getEntityType());
133133
}
134134
}
135135

136136
<T> void executeBatchDeleteRoot(DbAction.BatchDeleteRoot<T> batchDelete) {
137137

138138
List<Object> rootIds = batchDelete.getActions().stream().map(DbAction.DeleteRoot::id).toList();
139-
accessStrategy.delete(rootIds, batchDelete.entityType());
139+
accessStrategy.delete(rootIds, batchDelete.getEntityType());
140140
}
141141

142142
<T> void executeDelete(DbAction.Delete<T> delete) {
@@ -152,7 +152,7 @@ <T> void executeBatchDelete(DbAction.BatchDelete<T> batchDelete) {
152152

153153
<T> void executeDeleteAllRoot(DbAction.DeleteAllRoot<T> deleteAllRoot) {
154154

155-
accessStrategy.deleteAll(deleteAllRoot.entityType());
155+
accessStrategy.deleteAll(deleteAllRoot.getEntityType());
156156
}
157157

158158
<T> void executeDeleteAll(DbAction.DeleteAll<T> delete) {
@@ -161,11 +161,11 @@ <T> void executeDeleteAll(DbAction.DeleteAll<T> delete) {
161161
}
162162

163163
<T> void executeAcquireLock(DbAction.AcquireLockRoot<T> acquireLock) {
164-
accessStrategy.acquireLockById(acquireLock.getId(), LockMode.PESSIMISTIC_WRITE, acquireLock.entityType());
164+
accessStrategy.acquireLockById(acquireLock.getId(), LockMode.PESSIMISTIC_WRITE, acquireLock.getEntityType());
165165
}
166166

167167
<T> void executeAcquireLockAllRoot(DbAction.AcquireLockAllRoot<T> acquireLock) {
168-
accessStrategy.acquireLockAll(LockMode.PESSIMISTIC_WRITE, acquireLock.entityType());
168+
accessStrategy.acquireLockAll(LockMode.PESSIMISTIC_WRITE, acquireLock.getEntityType());
169169
}
170170

171171
private void add(DbActionExecutionResult result) {
@@ -246,7 +246,7 @@ private Object getPotentialGeneratedIdFrom(DbAction.WithEntity<?> idOwningAction
246246

247247
private Object getIdFrom(DbAction.WithEntity<?> idOwningAction) {
248248

249-
RelationalPersistentEntity<?> persistentEntity = getRequiredPersistentEntity(idOwningAction.entityType());
249+
RelationalPersistentEntity<?> persistentEntity = getRequiredPersistentEntity(idOwningAction.getEntityType());
250250
Object identifier = persistentEntity.getIdentifierAccessor(idOwningAction.entity()).getIdentifier();
251251

252252
Assert.state(identifier != null, () -> "Couldn't obtain a required id value for " + persistentEntity);
@@ -309,7 +309,7 @@ private <S> Object setIdAndCascadingProperties(DbAction.WithEntity<S> action, @N
309309
S originalEntity = action.entity();
310310

311311
RelationalPersistentEntity<S> persistentEntity = (RelationalPersistentEntity<S>) context
312-
.getRequiredPersistentEntity(action.entityType());
312+
.getRequiredPersistentEntity(action.getEntityType());
313313
PersistentPropertyPathAccessor<S> propertyAccessor = converter.getPropertyAccessor(persistentEntity,
314314
originalEntity);
315315

@@ -349,7 +349,7 @@ private <T> RelationalPersistentEntity<T> getRequiredPersistentEntity(Class<T> t
349349

350350
private <T> void updateWithoutVersion(DbAction.UpdateRoot<T> update) {
351351

352-
if (!accessStrategy.update(update.entity(), update.entityType())) {
352+
if (!accessStrategy.update(update.entity(), update.getEntityType())) {
353353

354354
throw new IncorrectUpdateSemanticsDataAccessException(
355355
String.format(UPDATE_FAILED, update.entity(), getIdFrom(update)));
@@ -361,7 +361,7 @@ private <T> void updateWithVersion(DbAction.UpdateRoot<T> update) {
361361
Number previousVersion = update.getPreviousVersion();
362362
Assert.notNull(previousVersion, "The root aggregate cannot be updated because the version property is null");
363363

364-
if (!accessStrategy.updateWithVersion(update.entity(), update.entityType(), previousVersion)) {
364+
if (!accessStrategy.updateWithVersion(update.entity(), update.getEntityType(), previousVersion)) {
365365

366366
throw new OptimisticLockingFailureException(String.format(UPDATE_FAILED_OPTIMISTIC_LOCKING, update.entity()));
367367
}

spring-data-relational/src/main/java/org/springframework/data/relational/core/conversion/DbAction.java

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
*/
4343
public interface DbAction<T> {
4444

45-
Class<T> entityType();
45+
Class<T> getEntityType();
4646

4747
/**
4848
* Represents an insert statement for a single entity that is not the root of an aggregate.
@@ -66,8 +66,8 @@ public Insert(T entity, PersistentPropertyPath<RelationalPersistentProperty> pro
6666
}
6767

6868
@Override
69-
public Class<T> entityType() {
70-
return WithDependingOn.super.entityType();
69+
public Class<T> getEntityType() {
70+
return WithDependingOn.super.getEntityType();
7171
}
7272

7373

@@ -177,12 +177,12 @@ public String toString() {
177177
*
178178
* @param <T> type of the entity for which this represents a database interaction.
179179
*/
180-
record DeleteRoot<T>(Object id, Class<T> entityType, @Nullable Number previousVersion) implements DbAction<T> {
180+
record DeleteRoot<T>(Object id, Class<T> getEntityType, @Nullable Number previousVersion) implements DbAction<T> {
181181

182182

183183
public String toString() {
184184

185-
return "DbAction.DeleteRoot(id=" + this.id() + ", entityType=" + this.entityType() + ", previousVersion="
185+
return "DbAction.DeleteRoot(id=" + this.id() + ", entityType=" + this.getEntityType() + ", previousVersion="
186186
+ this.previousVersion() + ")";
187187
}
188188
}
@@ -211,11 +211,11 @@ public String toString() {
211211
*
212212
* @param <T> type of the entity for which this represents a database interaction.
213213
*/
214-
record DeleteAllRoot<T>(Class<T> entityType) implements DbAction<T> {
214+
record DeleteAllRoot<T>(Class<T> getEntityType) implements DbAction<T> {
215215

216216

217217
public String toString() {
218-
return "DbAction.DeleteAllRoot(entityType=" + this.entityType() + ")";
218+
return "DbAction.DeleteAllRoot(entityType=" + this.getEntityType() + ")";
219219
}
220220
}
221221

@@ -238,12 +238,12 @@ public Object getId() {
238238
return this.id;
239239
}
240240

241-
public Class<T> entityType() {
241+
public Class<T> getEntityType() {
242242
return this.entityType;
243243
}
244244

245245
public String toString() {
246-
return "DbAction.AcquireLockRoot(id=" + this.getId() + ", entityType=" + this.entityType() + ")";
246+
return "DbAction.AcquireLockRoot(id=" + this.getId() + ", entityType=" + this.getEntityType() + ")";
247247
}
248248
}
249249

@@ -260,12 +260,12 @@ final class AcquireLockAllRoot<T> implements DbAction<T> {
260260
this.entityType = entityType;
261261
}
262262

263-
public Class<T> entityType() {
263+
public Class<T> getEntityType() {
264264
return this.entityType;
265265
}
266266

267267
public String toString() {
268-
return "DbAction.AcquireLockAllRoot(entityType=" + this.entityType() + ")";
268+
return "DbAction.AcquireLockAllRoot(entityType=" + this.getEntityType() + ")";
269269
}
270270
}
271271

@@ -301,8 +301,8 @@ abstract class BatchWithValue<T, A extends DbAction<T>, B> implements DbAction<T
301301
}
302302

303303
@Override
304-
public Class<T> entityType() {
305-
return actions.get(0).entityType();
304+
public Class<T> getEntityType() {
305+
return actions.get(0).getEntityType();
306306
}
307307

308308
public List<A> getActions() {
@@ -366,7 +366,7 @@ public BatchDelete(List<Delete<T>> actions) {
366366
final class BatchDeleteRoot<T> extends BatchWithValue<T, DeleteRoot<T>, Class<T>> {
367367

368368
BatchDeleteRoot(List<DeleteRoot<T>> actions) {
369-
super(actions, DeleteRoot::entityType);
369+
super(actions, DeleteRoot::getEntityType);
370370
}
371371
}
372372

@@ -423,8 +423,8 @@ default Pair<PersistentPropertyPath<RelationalPersistentProperty>, Object> getQu
423423
}
424424

425425
@Override
426-
default Class<T> entityType() {
427-
return WithEntity.super.entityType();
426+
default Class<T> getEntityType() {
427+
return WithEntity.super.getEntityType();
428428
}
429429
}
430430

@@ -443,7 +443,7 @@ interface WithEntity<T> extends DbAction<T> {
443443

444444
@SuppressWarnings("unchecked")
445445
@Override
446-
default Class<T> entityType() {
446+
default Class<T> getEntityType() {
447447
return (Class<T>) entity().getClass();
448448
}
449449

@@ -479,7 +479,7 @@ interface WithPropertyPath<T> extends DbAction<T> {
479479

480480
@SuppressWarnings("unchecked")
481481
@Override
482-
default Class<T> entityType() {
482+
default Class<T> getEntityType() {
483483
return (Class<T>) propertyPath().getLeafProperty().getActualType();
484484
}
485485
}

spring-data-relational/src/main/java/org/springframework/data/relational/core/conversion/WritingContext.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ private List<? extends DbAction<?>> insertAll(PersistentPropertyPath<RelationalP
137137
Pair<Object, Object> value = (Pair) node.value();
138138
qualifiers.put(node.path(), value.getFirst());
139139

140-
RelationalPersistentEntity<?> parentEntity = context.getRequiredPersistentEntity(parentAction.entityType());
140+
RelationalPersistentEntity<?> parentEntity = context.getRequiredPersistentEntity(parentAction.getEntityType());
141141

142142
if (!parentEntity.hasIdProperty() && parentAction instanceof DbAction.Insert) {
143143
qualifiers.putAll(((DbAction.Insert<?>) parentAction).qualifiers());

spring-data-relational/src/test/java/org/springframework/data/relational/core/conversion/DeleteBatchingAggregateChangeTest.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ void yieldsDeleteActionsAsBatchDeletes_groupedByPath_whenGroupContainsMultipleDe
7373
change.add(aggregateChange);
7474

7575
List<DbAction<?>> actions = extractActions(change);
76-
assertThat(actions).extracting(DbAction::getClass, DbAction::entityType) //
76+
assertThat(actions).extracting(DbAction::getClass, DbAction::getEntityType) //
7777
.containsExactly(Tuple.tuple(DbAction.BatchDelete.class, Intermediate.class));
7878
assertThat(getBatchWithValueAction(actions, Intermediate.class, DbAction.BatchDelete.class).getActions())
7979
.containsExactly(intermediateDelete1, intermediateDelete2);
@@ -165,7 +165,7 @@ void yieldsDeleteRootActionsWithoutVersionAsBatchDeleteRoots_whenGroupContainsMu
165165
change.add(aggregateChange4);
166166

167167
List<DbAction<?>> actions = extractActions(change);
168-
assertThat(actions).extracting(DbAction::getClass, DbAction::entityType).containsExactly( //
168+
assertThat(actions).extracting(DbAction::getClass, DbAction::getEntityType).containsExactly( //
169169
Tuple.tuple(DbAction.BatchDeleteRoot.class, Root.class), //
170170
Tuple.tuple(DbAction.DeleteRoot.class, Root.class), //
171171
Tuple.tuple(DbAction.DeleteRoot.class, Root.class));
@@ -194,7 +194,7 @@ private <T, A> List<DbAction.BatchWithValue<T, DbAction<T>, Object>> getBatchWit
194194

195195
return actions.stream() //
196196
.filter(dbAction -> dbAction.getClass().equals(batchActionType)) //
197-
.filter(dbAction -> dbAction.entityType().equals(entityType)) //
197+
.filter(dbAction -> dbAction.getEntityType().equals(entityType)) //
198198
.map(dbAction -> (DbAction.BatchWithValue<T, DbAction<T>, Object>) dbAction).collect(Collectors.toList());
199199
}
200200

spring-data-relational/src/test/java/org/springframework/data/relational/core/conversion/RelationalEntityDeleteWriterUnitTests.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ public void deleteDeletesTheEntityAndReferencedEntities() {
5656
converter.write(entity.id, aggregateChange);
5757

5858
assertThat(extractActions(aggregateChange))
59-
.extracting(DbAction::getClass, DbAction::entityType, DbActionTestSupport::extractPath) //
59+
.extracting(DbAction::getClass, DbAction::getEntityType, DbActionTestSupport::extractPath) //
6060
.containsExactly( //
6161
Tuple.tuple(AcquireLockRoot.class, SomeEntity.class, ""), //
6262
Tuple.tuple(Delete.class, YetAnother.class, "other.yetAnother"), //
@@ -75,7 +75,7 @@ public void deleteDeletesTheEntityAndNoReferencedEntities() {
7575
converter.write(entity.id, aggregateChange);
7676

7777
assertThat(extractActions(aggregateChange))
78-
.extracting(DbAction::getClass, DbAction::entityType, DbActionTestSupport::extractPath) //
78+
.extracting(DbAction::getClass, DbAction::getEntityType, DbActionTestSupport::extractPath) //
7979
.containsExactly(Tuple.tuple(DeleteRoot.class, SingleEntity.class, ""));
8080
}
8181

@@ -87,7 +87,7 @@ public void deleteAllDeletesAllEntitiesAndReferencedEntities() {
8787
converter.write(null, aggregateChange);
8888

8989
assertThat(extractActions(aggregateChange))
90-
.extracting(DbAction::getClass, DbAction::entityType, DbActionTestSupport::extractPath) //
90+
.extracting(DbAction::getClass, DbAction::getEntityType, DbActionTestSupport::extractPath) //
9191
.containsExactly( //
9292
Tuple.tuple(AcquireLockAllRoot.class, SomeEntity.class, ""), //
9393
Tuple.tuple(DeleteAll.class, YetAnother.class, "other.yetAnother"), //
@@ -104,7 +104,7 @@ public void deleteAllDeletesAllEntitiesAndNoReferencedEntities() {
104104
converter.write(null, aggregateChange);
105105

106106
assertThat(extractActions(aggregateChange))
107-
.extracting(DbAction::getClass, DbAction::entityType, DbActionTestSupport::extractPath) //
107+
.extracting(DbAction::getClass, DbAction::getEntityType, DbActionTestSupport::extractPath) //
108108
.containsExactly(Tuple.tuple(DeleteAllRoot.class, SingleEntity.class, ""));
109109
}
110110

@@ -119,7 +119,7 @@ public void deleteDoesNotDeleteReadOnlyReferences() {
119119
converter.write(entity.id, aggregateChange);
120120

121121
assertThat(extractActions(aggregateChange))
122-
.extracting(DbAction::getClass, DbAction::entityType, DbActionTestSupport::extractPath) //
122+
.extracting(DbAction::getClass, DbAction::getEntityType, DbActionTestSupport::extractPath) //
123123
.containsExactly( //
124124
Tuple.tuple(DeleteRoot.class, WithReadOnlyReference.class, "") //
125125
);
@@ -136,7 +136,7 @@ public void deleteAllDoesNotDeleteReadOnlyReferences() {
136136
converter.write(null, aggregateChange);
137137

138138
assertThat(extractActions(aggregateChange))
139-
.extracting(DbAction::getClass, DbAction::entityType, DbActionTestSupport::extractPath) //
139+
.extracting(DbAction::getClass, DbAction::getEntityType, DbActionTestSupport::extractPath) //
140140
.containsExactly( //
141141
Tuple.tuple(DeleteAllRoot.class, WithReadOnlyReference.class, "") //
142142
);

spring-data-relational/src/test/java/org/springframework/data/relational/core/conversion/RelationalEntityInsertWriterUnitTests.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ public void newEntityGetsConvertedToOneInsert() {
4848
new RelationalEntityInsertWriter<SingleReferenceEntity>(context).write(entity, aggregateChange);
4949

5050
assertThat(extractActions(aggregateChange)) //
51-
.extracting(DbAction::getClass, DbAction::entityType, DbActionTestSupport::extractPath,
51+
.extracting(DbAction::getClass, DbAction::getEntityType, DbActionTestSupport::extractPath,
5252
DbActionTestSupport::actualEntityType, DbActionTestSupport::isWithDependsOn) //
5353
.containsExactly( //
5454
tuple(InsertRoot.class, SingleReferenceEntity.class, "", SingleReferenceEntity.class, false) //
@@ -65,7 +65,7 @@ public void existingEntityGetsNotConvertedToDeletePlusUpdate() {
6565
new RelationalEntityInsertWriter<SingleReferenceEntity>(context).write(entity, aggregateChange);
6666

6767
assertThat(extractActions(aggregateChange)) //
68-
.extracting(DbAction::getClass, DbAction::entityType, DbActionTestSupport::extractPath,
68+
.extracting(DbAction::getClass, DbAction::getEntityType, DbActionTestSupport::extractPath,
6969
DbActionTestSupport::actualEntityType, DbActionTestSupport::isWithDependsOn) //
7070
.containsExactly( //
7171
tuple(InsertRoot.class, SingleReferenceEntity.class, "", SingleReferenceEntity.class, false) //

spring-data-relational/src/test/java/org/springframework/data/relational/core/conversion/RelationalEntityUpdateWriterUnitTests.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ public void existingEntityGetsConvertedToDeletePlusUpdate() {
4949
new RelationalEntityUpdateWriter<SingleReferenceEntity>(context).write(entity, aggregateChange);
5050

5151
assertThat(extractActions(aggregateChange)) //
52-
.extracting(DbAction::getClass, DbAction::entityType, DbActionTestSupport::extractPath,
52+
.extracting(DbAction::getClass, DbAction::getEntityType, DbActionTestSupport::extractPath,
5353
DbActionTestSupport::actualEntityType, DbActionTestSupport::isWithDependsOn) //
5454
.containsExactly( //
5555
tuple(DbAction.UpdateRoot.class, SingleReferenceEntity.class, "", SingleReferenceEntity.class, false), //

0 commit comments

Comments
 (0)