@ SuppressWarnings ( { "rawtypes" , "unchecked" } ) private IntegrationFlowBuilder getFlowBuilder ( ) { IntegrationFlowBuilder flowBuilder ; URLName urlName = this . properties . getUrl ( ) ; if ( this . properties . isIdleImap ( ) ) { flowBuilder = getIdleImapFlow ( urlName ) ; } else { MailInboundChannelAdapterSpec adapterSpec ; switch ( urlName . getProtocol ( ) . toUpperCase ( ) ) { case "IMAP" : case "IMAPS" : adapterSpec = getImapFlowBuilder ( urlName ) ; break ; case "POP3" : case "POP3S" : adapterSpec = getPop3FlowBuilder ( urlName ) ; break ; default : throw new IllegalArgumentException ( "Unsupported mail protocol: " + urlName . getProtocol ( ) ) ; } flowBuilder = IntegrationFlows . from ( adapterSpec . javaMailProperties ( getJavaMailProperties ( urlName ) ) . selectorExpression ( this . properties . getExpression ( ) ) . shouldDeleteMessages ( this . properties . isDelete ( ) ) , new Consumer < SourcePollingChannelAdapterSpec > ( ) { @ Override public void accept ( SourcePollingChannelAdapterSpec sourcePollingChannelAdapterSpec ) { sourcePollingChannelAdapterSpec . poller ( MailSourceConfiguration . this . defaultPoller ) ; } } ) ; } return flowBuilder ; }
Method to build Integration Flow for Mail . Suppress Warnings for MailInboundChannelAdapterSpec .