private static FaxClientSpiInterceptor [ ] createFaxClientSpiInterceptors ( FaxClientSpi faxClientSpi ) { //get type list String typeListStr = faxClientSpi . getConfigurationValue ( FaxClientSpiFactory . SPI_INTERCEPTOR_LIST_PROPERTY_KEY ) ; FaxClientSpiInterceptor [ ] interceptors = null ; if ( typeListStr != null ) { //split list String [ ] types = typeListStr . split ( FaxClientSpiFactory . SPI_INTERCEPTOR_LIST_SEPARATOR ) ; //get amount int amount = types . length ; String type = null ; String propertyKey = null ; String className = null ; FaxClientSpiInterceptor interceptor = null ; List < FaxClientSpiInterceptor > interceptorList = new LinkedList < FaxClientSpiInterceptor > ( ) ; for ( int index = 0 ; index < amount ; index ++ ) { //get next type type = types [ index ] ; if ( ( type != null ) && ( type . length ( ) > 0 ) ) { //get property key propertyKey = FaxClientSpiFactory . SPI_INTERCEPTOR_TYPE_PROPERTY_KEY_PREFIX + type ; //get class name className = faxClientSpi . getConfigurationValue ( propertyKey ) ; if ( className == null ) { throw new FaxException ( "Class name not defined by property: " + propertyKey + " for SPI interceptor." ) ; } //create new instance interceptor = ( FaxClientSpiInterceptor ) ReflectionHelper . createInstance ( className ) ; //initialize interceptor . initialize ( faxClientSpi ) ; //add to list interceptorList . add ( interceptor ) ; } //convert to array interceptors = interceptorList . toArray ( new FaxClientSpiInterceptor [ interceptorList . size ( ) ] ) ; } } return interceptors ; }
This function creates the fax client SPI interceptors .