KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jboss > joinpoint > plugins > BasicConstructorJoinPoint


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.joinpoint.plugins;
23
24 import org.jboss.joinpoint.spi.ConstructorJoinpoint;
25 import org.jboss.reflect.spi.ConstructorInfo;
26 import org.jboss.util.UnreachableStatementException;
27
28 /**
29  * A constructor joinpoint
30  *
31  * @author <a HREF="mailto:adrian@jboss.org">Adrian Brock</a>
32  */

33 public class BasicConstructorJoinPoint implements ConstructorJoinpoint
34 {
35    /** The constructor info */
36    protected ConstructorInfo constructorInfo;
37
38    /** The arguments */
39    protected Object JavaDoc[] arguments;
40
41    /**
42     * Create a new constructor join point
43     *
44     * @param constructorInfo the constructor info
45     */

46    public BasicConstructorJoinPoint(ConstructorInfo constructorInfo)
47    {
48       this.constructorInfo = constructorInfo;
49    }
50
51    public ConstructorInfo getConstructorInfo()
52    {
53       return constructorInfo;
54    }
55    
56    public Object JavaDoc[] getArguments()
57    {
58       return arguments;
59    }
60
61    public void setArguments(Object JavaDoc[] args)
62    {
63       this.arguments = args;
64    }
65
66    public Object JavaDoc clone()
67    {
68       try
69       {
70          return super.clone();
71       }
72       catch (CloneNotSupportedException JavaDoc e)
73       {
74          throw new UnreachableStatementException();
75       }
76    }
77
78    public Object JavaDoc dispatch() throws Throwable JavaDoc
79    {
80       return constructorInfo.newInstance(arguments);
81    }
82    
83    public String JavaDoc toHumanReadableString()
84    {
85       return constructorInfo.toString();
86    }
87 }
88
Popular Tags