spring-projects / spring-projects/spring-data-commons
Inconsistent method names [DATACMNS-1303]
Open
@odrotbohm is already working on this.
Since Dec 30, 2020.
type: enhancement
- Dominant language
- Java
- Stars
- 838
- Forks
- 730
- PR merge metrics
- No merged PRs in 30d
Description
Kui Liu opened DATACMNS-1303 and commented
The following two methods are adding given events to the "domainEvents", so that their names should be "addEvents" and "addEventsFrom". However, they are named as "andEvents" and "andEventsFrom" respectively, which seems confusing.
/**
* Adds the given event to the aggregate for later publication when calling a Spring Data repository's save-method.
* Does the same as {@link #registerEvent(Object)} but returns the aggregate instead of the event.
*
* @param event must not be {@literal null}.
* @return the aggregate
* @see #registerEvent(Object)
*/
@SuppressWarnings("unchecked")
protected final A andEvent(Object event) {
registerEvent(event);
return (A) this;
}
/**
* Adds all events contained in the given aggregate to the current one.
*
* @param aggregate must not be {@literal null}.
* @return the aggregate
*/
@SuppressWarnings("unchecked")
protected final A andEventsFrom(A aggregate) {
Assert.notNull(aggregate, "Aggregate must not be null!");
this.domainEvents.addAll(aggregate.domainEvents());
return (A) this;
}
Attachments:
- rename-methods.patch (3.05 kB)
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.