public static IntegrationFlowBuilder enhanceFlowForReadingMode(IntegrationFlowBuilder flowBuilder,
			FileConsumerProperties fileConsumerProperties) {
		switch (fileConsumerProperties.getMode()) {
		case contents:
			flowBuilder.enrichHeaders(Collections.<String, Object>singletonMap(MessageHeaders.CONTENT_TYPE,
					"application/octet-stream"))
					.transform(Transformers.fileToByteArray());
			break;
		case lines:
			Boolean withMarkers = fileConsumerProperties.getWithMarkers();
			if (withMarkers == null) {
				withMarkers = false;
			}
			flowBuilder.enrichHeaders(Collections.<String, Object>singletonMap(MessageHeaders.CONTENT_TYPE,
					"text/plain"))
					.split(new FileSplitter(true, withMarkers, fileConsumerProperties.getMarkersJson()));
		case ref:
			break;
		default:
			throw new IllegalArgumentException(fileConsumerProperties.getMode().name() +
					" is not a supported file reading mode.");
		}
		return flowBuilder;
	}
public static IntegrationFlowBuilder enhanceFlowForReadingMode ( IntegrationFlowBuilder flowBuilder , FileConsumerProperties fileConsumerProperties ) { switch ( fileConsumerProperties . getMode ( ) ) { case contents : flowBuilder . enrichHeaders ( Collections . < String , Object > singletonMap ( MessageHeaders . CONTENT_TYPE , "application/octet-stream" ) ) . transform ( Transformers . fileToByteArray ( ) ) ; break ; case lines : Boolean withMarkers = fileConsumerProperties . getWithMarkers ( ) ; if ( withMarkers == null ) { withMarkers = false ; } flowBuilder . enrichHeaders ( Collections . < String , Object > singletonMap ( MessageHeaders . CONTENT_TYPE , "text/plain" ) ) . split ( new FileSplitter ( true , withMarkers , fileConsumerProperties . getMarkersJson ( ) ) ) ; case ref : break ; default : throw new IllegalArgumentException ( fileConsumerProperties . getMode ( ) . name ( ) + " is not a supported file reading mode." ) ; } return flowBuilder ; }
Enhance an {@link IntegrationFlowBuilder} to add flow snippets, depending on
{@link FileConsumerProperties}.
@param flowBuilder the flow builder.
@param fileConsumerProperties the properties.
@return the updated flow builder.