@ SuppressWarnings ( "unchecked" ) public T apply ( T io ) { logger . debug ( "Pipeline began" ) ; try { for ( int i = 0 ; i < stages . size ( ) ; i ++ ) { Object stage = stages . get ( i ) ; String name = names . get ( stage ) ; logger . debug ( "Stage-" + i + ( ( name != null && ! name . isEmpty ( ) ) ? " [" + name + "] " : " " ) + "processing" ) ; if ( stage instanceof Function ) { if ( ( io = ( ( Function < T , T > ) stage ) . apply ( io ) ) == null ) { return io ; } } else if ( stage instanceof Predicate ) { if ( ! ( ( Predicate < T > ) stage ) . apply ( io ) ) { return io ; } } } return io ; } finally { logger . debug ( "Pipeline ended" ) ; } }
Starts pipeline with the specified stream object that flows through this pipeline .