36
36
import static io .javaoperatorsdk .operator .api .reconciler .Constants .DEFAULT_NAMESPACES_SET ;
37
37
38
38
@ SuppressWarnings ("rawtypes" )
39
- public class AnnotationControllerConfiguration <R extends HasMetadata >
40
- implements io .javaoperatorsdk .operator .api .config .ControllerConfiguration <R > {
39
+ public class AnnotationControllerConfiguration <P extends HasMetadata >
40
+ implements io .javaoperatorsdk .operator .api .config .ControllerConfiguration <P > {
41
41
42
- protected final Reconciler <R > reconciler ;
42
+ protected final Reconciler <P > reconciler ;
43
43
private final ControllerConfiguration annotation ;
44
44
private List <DependentResourceSpec > specs ;
45
- private Class <R > resourceClass ;
45
+ private Class <P > resourceClass ;
46
46
47
- public AnnotationControllerConfiguration (Reconciler <R > reconciler ) {
47
+ public AnnotationControllerConfiguration (Reconciler <P > reconciler ) {
48
48
this .reconciler = reconciler ;
49
49
this .annotation = reconciler .getClass ().getAnnotation (ControllerConfiguration .class );
50
50
if (annotation == null ) {
@@ -89,10 +89,10 @@ public Set<String> getNamespaces() {
89
89
90
90
@ Override
91
91
@ SuppressWarnings ("unchecked" )
92
- public Class <R > getResourceClass () {
92
+ public Class <P > getResourceClass () {
93
93
if (resourceClass == null ) {
94
94
resourceClass =
95
- (Class <R >) Utils .getFirstTypeArgumentFromSuperClassOrInterface (reconciler .getClass (),
95
+ (Class <P >) Utils .getFirstTypeArgumentFromSuperClassOrInterface (reconciler .getClass (),
96
96
Reconciler .class );
97
97
}
98
98
return resourceClass ;
@@ -110,16 +110,16 @@ public String getAssociatedReconcilerClassName() {
110
110
111
111
@ SuppressWarnings ("unchecked" )
112
112
@ Override
113
- public ResourceEventFilter <R > getEventFilter () {
114
- ResourceEventFilter <R > answer = null ;
113
+ public ResourceEventFilter <P > getEventFilter () {
114
+ ResourceEventFilter <P > answer = null ;
115
115
116
- Class <ResourceEventFilter <R >>[] filterTypes =
117
- (Class <ResourceEventFilter <R >>[]) valueOrDefault (annotation ,
116
+ Class <ResourceEventFilter <P >>[] filterTypes =
117
+ (Class <ResourceEventFilter <P >>[]) valueOrDefault (annotation ,
118
118
ControllerConfiguration ::eventFilters , new Object [] {});
119
119
if (filterTypes .length > 0 ) {
120
120
for (var filterType : filterTypes ) {
121
121
try {
122
- ResourceEventFilter <R > filter = filterType .getConstructor ().newInstance ();
122
+ ResourceEventFilter <P > filter = filterType .getConstructor ().newInstance ();
123
123
124
124
if (answer == null ) {
125
125
answer = filter ;
@@ -151,8 +151,8 @@ public Optional<Duration> reconciliationMaxInterval() {
151
151
152
152
@ Override
153
153
@ SuppressWarnings ("unchecked" )
154
- public Optional <Predicate <R >> onAddFilter () {
155
- return (Optional <Predicate <R >>) createFilter (annotation .onAddFilter (), FilterType .onAdd ,
154
+ public Optional <Predicate <P >> onAddFilter () {
155
+ return (Optional <Predicate <P >>) createFilter (annotation .onAddFilter (), FilterType .onAdd ,
156
156
annotation .getClass ().getSimpleName ());
157
157
}
158
158
@@ -186,8 +186,8 @@ private <T> Optional<T> createFilter(Class<T> filter, FilterType filterType, Str
186
186
187
187
@ SuppressWarnings ("unchecked" )
188
188
@ Override
189
- public Optional <BiPredicate <R , R >> onUpdateFilter () {
190
- return (Optional <BiPredicate <R , R >>) createFilter (annotation .onUpdateFilter (),
189
+ public Optional <BiPredicate <P , P >> onUpdateFilter () {
190
+ return (Optional <BiPredicate <P , P >>) createFilter (annotation .onUpdateFilter (),
191
191
FilterType .onUpdate , annotation .getClass ().getSimpleName ());
192
192
}
193
193
@@ -259,6 +259,7 @@ private String getName(Dependent dependent, Class<? extends DependentResource> d
259
259
return name ;
260
260
}
261
261
262
+ @ SuppressWarnings ("rawtypes" )
262
263
private Object createKubernetesResourceConfig (Class <? extends DependentResource > dependentType ) {
263
264
264
265
Object config ;
@@ -291,7 +292,6 @@ private Object createKubernetesResourceConfig(Class<? extends DependentResource>
291
292
.orElse (null );
292
293
}
293
294
294
-
295
295
config =
296
296
new KubernetesDependentResourceConfig (namespaces , labelSelector , configuredNS , onAddFilter ,
297
297
onUpdateFilter , onDeleteFilter );
0 commit comments