Polishing.

Handle warnings. Remove redundant code in DefaultReactiveEntityCallbacks.

Original pull request: #3053
See #3055
This commit is contained in:
Mark Paluch
2024-03-01 11:47:40 +01:00
parent dec7f74311
commit a32fe161d1
4 changed files with 5 additions and 4 deletions

View File

@@ -63,6 +63,7 @@ class DefaultEntityCallbacks implements EntityCallbacks {
}
@Override
@SuppressWarnings({ "unchecked", "rawtypes" })
public <T> T callback(Class<? extends EntityCallback> callbackType, T entity, Object... args) {
Assert.notNull(entity, "Entity must not be null");

View File

@@ -63,14 +63,12 @@ class DefaultReactiveEntityCallbacks implements ReactiveEntityCallbacks {
}
@Override
@SuppressWarnings("unchecked")
@SuppressWarnings({ "unchecked", "rawtypes" })
public <T> Mono<T> callback(Class<? extends EntityCallback> callbackType, T entity, Object... args) {
Assert.notNull(entity, "Entity must not be null");
Class<T> entityType = (Class<T>) (entity != null
? ClassUtils.getUserClass(entity.getClass())
: callbackDiscoverer.resolveDeclaredEntityType(callbackType).getRawClass());
Class<T> entityType = (Class<T>) ClassUtils.getUserClass(entity.getClass());
Method callbackMethod = callbackMethodCache.computeIfAbsent(callbackType, it -> {

View File

@@ -47,6 +47,7 @@ public interface EntityCallbacks {
* @return never {@literal null}.
* @throws IllegalArgumentException if a required argument is {@literal null}.
*/
@SuppressWarnings("rawtypes")
<T> T callback(Class<? extends EntityCallback> callbackType, T entity, Object... args);
/**

View File

@@ -50,6 +50,7 @@ public interface ReactiveEntityCallbacks {
* @return a {@link Mono} emitting the result after invoking the callbacks.
* @throws IllegalArgumentException if a required argument is {@literal null}.
*/
@SuppressWarnings("rawtypes")
<T> Mono<T> callback(Class<? extends EntityCallback> callbackType, T entity, Object... args);
/**