File tree Expand file tree Collapse file tree 2 files changed +8
-2
lines changed
operator-framework-core/src/main/java/io/javaoperatorsdk/operator/api/config Expand file tree Collapse file tree 2 files changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -27,9 +27,9 @@ default String getLabelSelector() {
27
27
return null ;
28
28
}
29
29
30
+ @ SuppressWarnings ("unchecked" )
30
31
default Class <R > getResourceClass () {
31
- ParameterizedType type = (ParameterizedType ) getClass ().getGenericInterfaces ()[0 ];
32
- return (Class <R >) type .getActualTypeArguments ()[0 ];
32
+ return (Class <R >) Utils .getFirstTypeArgumentFromInterface (getClass ());
33
33
}
34
34
35
35
default Set <String > getNamespaces () {
Original file line number Diff line number Diff line change 1
1
package io .javaoperatorsdk .operator .api .config ;
2
2
3
3
import java .io .IOException ;
4
+ import java .lang .reflect .ParameterizedType ;
4
5
import java .text .SimpleDateFormat ;
5
6
import java .time .Instant ;
6
7
import java .util .Date ;
@@ -67,4 +68,9 @@ public static boolean shouldCheckCRDAndValidateLocalModel() {
67
68
public static boolean debugThreadPool () {
68
69
return Boolean .getBoolean (System .getProperty (DEBUG_THREAD_POOL_ENV_KEY , "false" ));
69
70
}
71
+
72
+ public static Class <?> getFirstTypeArgumentFromInterface (Class <?> clazz ) {
73
+ ParameterizedType type = (ParameterizedType ) clazz .getGenericInterfaces ()[0 ];
74
+ return (Class <?>) type .getActualTypeArguments ()[0 ];
75
+ }
70
76
}
You can’t perform that action at this time.
0 commit comments