KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > jac > core > rtti > VirtualClassItem


1 /*
2   Copyright (C) 2001-2003 Renaud Pawlak <renaud@aopsys.com>,
3                           Laurent Martelli <laurent@aopsys.com>
4   
5   This program is free software; you can redistribute it and/or modify
6   it under the terms of the GNU Lesser General Public License as
7   published by the Free Software Foundation; either version 2 of the
8   License, or (at your option) any later version.
9
10   This program is distributed in the hope that it will be useful,
11   but WITHOUT ANY WARRANTY; without even the implied warranty of
12   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13   GNU Lesser General Public License for more details.
14
15   You should have received a copy of the GNU Lesser General Public License
16   along with this program; if not, write to the Free Software
17   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */

18
19
20 package org.objectweb.jac.core.rtti;
21
22 /**
23  * This class defines a meta item that corresponds to the
24  * <code>java.lang.reflect.Class</code> meta element.<p>
25  *
26  * @author Renaud Pawlak
27  * @author Laurent Martelli
28  */

29
30 public class VirtualClassItem extends MetaItem {
31
32    String JavaDoc name;
33    ClassItem actualType;
34
35    /**
36     * Default contructor to create a new virtual class item object.<p>
37     *
38     * @param name the name of the virtual class to create
39     * @param actualType the existing real class it can substituted to
40     */

41    public VirtualClassItem(String JavaDoc name, ClassItem actualType) {
42       this.name = name;
43       this.actualType = actualType;
44    }
45
46    public String JavaDoc getName() {
47       return name;
48    }
49
50    public ClassItem getActualType() {
51       return actualType;
52    }
53
54    public Object JavaDoc getAttribute(String JavaDoc attribute) {
55       Object JavaDoc value = super.getAttribute(attribute);
56       if (value==null && actualType!=null) {
57          value = actualType.getAttribute(attribute);
58       }
59       return value;
60    }
61
62    public String JavaDoc toString() {
63       return "VirtualClassItem "+name;
64    }
65 }
66
Popular Tags