KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jfox > ioc > sample > SampleComponentA


1 /* JFox, the OpenSource J2EE Application Server
2  *
3  * Distributable under GNU LGPL license by gun.org
4  * more details please visit http://www.huihoo.org/jfox
5  */

6
7 package org.jfox.ioc.sample;
8
9 import java.lang.reflect.Method JavaDoc;
10
11 import org.jfox.ioc.Component;
12 import org.jfox.ioc.ComponentContext;
13 import org.jfox.ioc.ext.InterceptableComponent;
14
15 /**
16  * @author <a HREF="mailto:young_yy@hotmail.com">Young Yang</a>
17  */

18
19 public class SampleComponentA implements Component, InterceptableComponent, SampleComponent {
20     private String JavaDoc name = "Hello,World";
21
22     public SampleComponentA() {
23     }
24
25     public SampleComponentA(String JavaDoc name) {
26         this.name = name;
27     }
28
29     public String JavaDoc getName() {
30         return name;
31     }
32
33     public void setName(String JavaDoc name) {
34         this.name = name;
35     }
36
37     public void setComponent(Component tc) {
38
39     }
40
41     public void preInvoke(Method JavaDoc method, Object JavaDoc[] params) {
42         if(!method.getName().equals("toString")){
43             System.out.println("Intercepter: preInvoke "+ this.getClass().getName() + "." + method.getName());
44         }
45     }
46
47     public Object JavaDoc postInvoke(Method JavaDoc method, Object JavaDoc result) {
48         if(!method.getName().equals("toString")){
49             System.out.println("Intercepter: postInvoke " + this.getClass().getName() + "." + method.getName());
50         }
51         return result;
52     }
53
54     public void setComponentContext(ComponentContext ctx) {
55
56     }
57
58     public Component afterInstantiate(Component component) {
59         System.out.println("Intercepter: Component " + this.getClass().getName() + " instantiated.");
60         return component;
61     }
62
63
64     public static void main(String JavaDoc[] args) {
65
66     }
67 }
68
69
Popular Tags