KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jboss > aop > ConstructionInfo


1 /*
2   * JBoss, Home of Professional Open Source
3   * Copyright 2005, JBoss Inc., and individual contributors as indicated
4   * by the @authors tag. See the copyright.txt in the distribution for a
5   * full listing of individual contributors.
6   *
7   * This is free software; you can redistribute it and/or modify it
8   * under the terms of the GNU Lesser General Public License as
9   * published by the Free Software Foundation; either version 2.1 of
10   * the License, or (at your option) any later version.
11   *
12   * This software is distributed in the hope that it will be useful,
13   * but WITHOUT ANY WARRANTY; without even the implied warranty of
14   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15   * Lesser General Public License for more details.
16   *
17   * You should have received a copy of the GNU Lesser General Public
18   * License along with this software; if not, write to the Free
19   * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
20   * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
21   */

22 package org.jboss.aop;
23
24 import java.lang.reflect.Constructor JavaDoc;
25
26 import org.jboss.aop.joinpoint.ConstructorJoinpoint;
27 import org.jboss.aop.joinpoint.Joinpoint;
28 import org.jboss.aop.util.MethodHashing;
29
30 /**
31  * Comment
32  *
33  * @author <a HREF="mailto:kabir.khan@jboss.org">Kabir Khan</a>
34  * @version $Revision$
35  */

36 public class ConstructionInfo extends JoinPointInfo
37 {
38    private Constructor JavaDoc constructor;
39    private int index;
40
41    public ConstructionInfo()
42    {
43       
44    }
45    
46    public ConstructionInfo(Class JavaDoc clazz, int index, long constructorHash, Advisor advisor)
47    {
48       super(advisor, clazz);
49       try
50       {
51          this.index = index;
52          this.constructor = MethodHashing.findConstructorByHash(clazz, constructorHash);
53          this.setAdvisor(advisor);
54       }
55       catch (Exception JavaDoc e)
56       {
57          throw new RuntimeException JavaDoc(e);
58       }
59    }
60    
61    /*
62     * For copying
63     */

64    private ConstructionInfo(ConstructionInfo other)
65    {
66       super(other);
67       this.constructor = other.constructor;
68       this.index = other.index;
69    }
70    
71    protected Joinpoint internalGetJoinpoint()
72    {
73       return new ConstructorJoinpoint(constructor);
74    }
75    
76    public JoinPointInfo copy()
77    {
78       return new ConstructionInfo(this);
79    }
80
81    public String JavaDoc toString()
82    {
83       StringBuffer JavaDoc sb = new StringBuffer JavaDoc("Construction");
84       sb.append("[");
85       sb.append("constructor=" + constructor);
86       sb.append("]");
87       return sb.toString();
88    }
89
90    public void setConstructor(Constructor JavaDoc constructor)
91    {
92       this.constructor = constructor;
93    }
94
95    public Constructor JavaDoc getConstructor()
96    {
97       return constructor;
98    }
99
100    public void setIndex(int index)
101    {
102       this.index = index;
103    }
104
105    public int getIndex()
106    {
107       return index;
108    }
109 }
110
Popular Tags