File tree Expand file tree Collapse file tree 1 file changed +3
-5
lines changed
operator-framework-core/src/main/java/io/javaoperatorsdk/operator/api/reconciler Expand file tree Collapse file tree 1 file changed +3
-5
lines changed Original file line number Diff line number Diff line change 4
4
5
5
import io .fabric8 .kubernetes .api .model .HasMetadata ;
6
6
import io .javaoperatorsdk .operator .processing .Controller ;
7
- import io .javaoperatorsdk .operator .processing .event .source .ResourceEventSource ;
8
7
9
8
public class DefaultContext <P extends HasMetadata > implements Context {
10
9
@@ -25,9 +24,8 @@ public Optional<RetryInfo> getRetryInfo() {
25
24
26
25
@ Override
27
26
public <T > Optional <T > getSecondaryResource (Class <T > expectedType , String eventSourceName ) {
28
- final Optional <ResourceEventSource <P , T >> eventSource =
29
- controller .getEventSourceManager ().getResourceEventSourceFor (expectedType , eventSourceName );
30
- return eventSource .isEmpty () ? Optional .empty ()
31
- : eventSource .get ().getAssociated (primaryResource );
27
+ return controller .getEventSourceManager ()
28
+ .getResourceEventSourceFor (expectedType , eventSourceName )
29
+ .flatMap (es -> es .getAssociated (primaryResource ));
32
30
}
33
31
}
You can’t perform that action at this time.
0 commit comments