1 17 18 package tutorial; 19 20 import java.lang.reflect.Constructor ; 21 import java.util.Map ; 22 23 import org.apache.avalon.composition.model.ContextualizationHandler; 24 import org.apache.avalon.framework.context.ContextException; 25 import org.apache.avalon.framework.context.Context; 26 27 35 public class DemoContextualizationHandler implements ContextualizationHandler 36 { 37 41 47 public void contextualize( 48 Object object, Context context ) 49 throws ContextException 50 { 51 52 58 if( object instanceof Contextualizable ) 59 { 60 StandardContext standard = new StandardContextImp( context ); 61 ( (Contextualizable)object ).contextualize( standard ); 62 } 63 else 64 { 65 final String error = 66 "Target object does not implement the " 67 + Contextualizable.class.getName() + " interface."; 68 throw new ContextException( error ); 69 } 70 } 71 } 72 | Popular Tags |