001    package com.hammurapi.config.runtime;
002    
003    import com.hammurapi.config.bootstrap.ConfigurationException;
004    import com.hammurapi.config.bootstrap.Destroyable;
005    import com.hammurapi.config.bootstrap.FactoryClosure;
006    
007    public abstract class FactoryClosureBase<T> implements FactoryClosure<T> {
008            
009            protected void toDestroy(T result) {
010                    if (result instanceof Destroyable) {
011                            destroyableSink.addDestroyable((Destroyable) result);
012                    }
013            }
014    
015            protected CompositeDestroyable destroyableSink = new CompositeDestroyable();
016            
017    
018            public Destroyable getDestroyable() throws ConfigurationException {
019                    return destroyableSink;
020            }
021    
022    }