DATACMNS-1508 - Polishing.

Add findAllById, deleteAll to CoroutineCrudRepository.

Keep CoroutineCrudRepository somewhat in sync with ReactiveCrudRepository by adding based methods for those accecpting Publisher.
Also add some test.

Update License Headers of Kotlin files and fix some warnings. Switch to kotlin-test-junit5.

Original pull request: #415.
This commit is contained in:
Christoph Strobl
2020-01-13 14:01:58 +01:00
committed by Mark Paluch
parent 93c708379e
commit 769b0f6af5
24 changed files with 171 additions and 48 deletions

View File

@@ -40,13 +40,12 @@ import org.springframework.lang.Nullable;
* errors.
*
* @author Mark Paluch
* @author Christoph Strobl
* @since 2.3
* @see org.springframework.core.KotlinDetector#isKotlinReflectPresent()
*/
public final class KotlinReflectionUtils {
private static final int KOTLIN_KIND_CLASS = 1;
private KotlinReflectionUtils() {}
/**
@@ -64,7 +63,7 @@ public final class KotlinReflectionUtils {
return Arrays.stream(type.getDeclaredAnnotations()) //
.filter(annotation -> annotation.annotationType().getName().equals("kotlin.Metadata")) //
.map(annotation -> AnnotationUtils.getValue(annotation, "k")) //
.anyMatch(it -> Integer.valueOf(KOTLIN_KIND_CLASS).equals(it));
.anyMatch(it -> Integer.valueOf(KotlinClassHeaderKind.CLASS.id).equals(it));
}
/**
@@ -202,4 +201,15 @@ public final class KotlinReflectionUtils {
Method javaMethod = ReflectJvmMapping.getJavaMethod(function);
return javaMethod != null && javaMethod.equals(method);
}
private enum KotlinClassHeaderKind {
CLASS(1), FILE(2), SYNTHETIC_CLASS(3), MULTI_FILE_CLASS_FACADE(4), MULTI_FILE_CLASS_PART(5);
int id;
KotlinClassHeaderKind(int val) {
this.id = val;
}
}
}