1 8 package org.codehaus.loom.components.util.infobuilder; 9 10 import org.codehaus.dna.Logger; 11 import org.codehaus.loom.components.util.info.ComponentInfo; 12 13 16 public class CascadingBlockInfoReader implements BlockInfoReader 17 { 18 private final LegacyBlockInfoReader m_legacyBlockInfoReader; 19 private final MetaClassBlockInfoReader m_metaClassBlockInfoReader = new MetaClassBlockInfoReader(); 20 21 public CascadingBlockInfoReader( final ClassLoader classLoader, final Logger logger ) 22 { 23 if( null == classLoader ) 24 { 25 throw new NullPointerException ( "classLoader" ); 26 } 27 else if( null == logger ) 28 { 29 throw new NullPointerException ( "logger" ); 30 } 31 32 m_legacyBlockInfoReader = new LegacyBlockInfoReader( classLoader, logger ); 33 } 34 35 public ComponentInfo buildComponentInfo( final Class type ) throws Exception 36 { 37 final ComponentInfo legacyComponentInfo = m_legacyBlockInfoReader.buildComponentInfo( type ); 38 39 if( null == legacyComponentInfo ) 40 { 41 return m_metaClassBlockInfoReader.buildComponentInfo( type ); 42 } 43 else 44 { 45 return legacyComponentInfo; 46 } 47 } 48 } | Popular Tags |