1 6 7 package org.jfox.ioc.component; 8 9 import java.lang.reflect.Method ; 10 11 import org.jfox.ioc.Component; 12 import org.jfox.ioc.ComponentContext; 13 import org.jfox.ioc.ext.InterceptableComponent; 14 15 20 21 public class TestComponentB implements InterceptableComponent, TestComponent { 22 private String name = "Hello,World!"; 23 24 private ComponentContext ctx; 25 26 public TestComponentB() { 27 } 28 29 public TestComponentB(String name) { 30 this.name = name; 31 } 32 33 public String getName() { 34 return name; 35 } 36 37 public void setName(String name) { 38 this.name = name; 39 } 40 41 public void preInvoke(Method method, Object [] params) { 42 System.out.println("preInvoke: " + method.getName()); 43 } 44 45 public Object postInvoke(Method method, Object result) { 46 System.out.println("postInvoke: " + method.getName()); 47 return result; 48 } 49 50 public String getComponentDir(){ 51 return ctx.getModuleDir(); 52 } 53 54 public void setComponentContext(ComponentContext ctx) { 55 this.ctx = ctx; 56 } 57 58 59 public Component afterInstantiate(Component component) { 60 System.out.println("afterInstantiate: Component " + this + " created."); 61 return component; 62 } 63 64 public static void main(String [] args) { 65 66 } 67 } 68 69 | Popular Tags |