001    /*
002      Copyright (C) 2001-2003 Renaud Pawlak <renaud@aopsys.com>, 
003                              Laurent Martelli <laurent@aopsys.com>
004      
005      This program is free software; you can redistribute it and/or modify
006      it under the terms of the GNU Lesser General Public License as
007      published by the Free Software Foundation; either version 2 of the
008      License, or (at your option) any later version.
009    
010      This program is distributed in the hope that it will be useful,
011      but WITHOUT ANY WARRANTY; without even the implied warranty of
012      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
013      GNU Lesser General Public License for more details.
014    
015      You should have received a copy of the GNU Lesser General Public License
016      along with this program; if not, write to the Free Software
017      Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
018    
019    
020    package org.objectweb.jac.core.rtti;
021    
022    /**
023     * This class defines a meta item that corresponds to the
024     * <code>java.lang.reflect.Class</code> meta element.<p>
025     *
026     * @author Renaud Pawlak
027     * @author Laurent Martelli
028     */
029    
030    public class VirtualClassItem extends MetaItem {
031    
032       String name;
033       ClassItem actualType;
034    
035       /**
036        * Default contructor to create a new virtual class item object.<p>
037        *
038        * @param name the name of the virtual class to create
039        * @param actualType the existing real class it can substituted to
040        */
041       public VirtualClassItem(String name, ClassItem actualType) {
042          this.name = name;
043          this.actualType = actualType;
044       }
045    
046       public String getName() {
047          return name;
048       }
049    
050       public ClassItem getActualType() {
051          return actualType;
052       }
053    
054       public Object getAttribute(String attribute) {
055          Object value = super.getAttribute(attribute);
056          if (value==null && actualType!=null) {
057             value = actualType.getAttribute(attribute);
058          }
059          return value;
060       }
061    
062       public String toString() {
063          return "VirtualClassItem "+name;
064       }
065    }