private AbstractChainedGlobalProcessor<T> addOrCreateChain(AbstractChainedGlobalProcessor<T> chain, String key) {

		AbstractChainedGlobalProcessor<T> toAdd;

		if (customPostprocessors.get(key) == null) {
			toAdd = buildProcessorByKey(key);
		} else {
			toAdd = (AbstractChainedGlobalProcessor<T>) customPostprocessors.get(key);
		}

		if (toAdd instanceof BundlingProcessLifeCycleListener && !listeners.contains(toAdd)) {
			listeners.add((BundlingProcessLifeCycleListener) toAdd);
		}

		AbstractChainedGlobalProcessor<T> newChainResult = null;
		if (chain == null) {
			newChainResult = toAdd;
		} else {
			chain.addNextProcessor(toAdd);
			newChainResult = chain;
		}

		return newChainResult;
	}
private AbstractChainedGlobalProcessor < T > addOrCreateChain ( AbstractChainedGlobalProcessor < T > chain , String key ) { AbstractChainedGlobalProcessor < T > toAdd ; if ( customPostprocessors . get ( key ) == null ) { toAdd = buildProcessorByKey ( key ) ; } else { toAdd = ( AbstractChainedGlobalProcessor < T > ) customPostprocessors . get ( key ) ; } if ( toAdd instanceof BundlingProcessLifeCycleListener && ! listeners . contains ( toAdd ) ) { listeners . add ( ( BundlingProcessLifeCycleListener ) toAdd ) ; } AbstractChainedGlobalProcessor < T > newChainResult = null ; if ( chain == null ) { newChainResult = toAdd ; } else { chain . addNextProcessor ( toAdd ) ; newChainResult = chain ; } return newChainResult ; }
Creates an AbstractChainedGlobalProcessor. If the supplied chain is null,
the new chain is returned. Otherwise it is added to the existing chain.

@param chain
the chained post processor
@param key
the id of the post processor
@return the chained post processor, with the new post processor.