001: /*
002: * Project: BeautyJ - Customizable Java Source Code Transformer
003: * Class: de.gulden.util.javasource.ClassInner
004: * Version: 1.1
005: *
006: * Date: 2004-09-29
007: *
008: * Note: Contains auto-generated Javadoc comments created by BeautyJ.
009: *
010: * This is licensed under the GNU General Public License (GPL)
011: * and comes with NO WARRANTY. See file license.txt for details.
012: *
013: * Author: Jens Gulden
014: * Email: beautyj@jensgulden.de
015: */
016:
017: package de.gulden.util.javasource;
018:
019: import javax.xml.parsers.*;
020: import org.w3c.dom.*;
021: import java.util.*;
022:
023: /**
024: * Represents an inner class declaration.
025: *
026: * @author Jens Gulden
027: * @version 1.0
028: */
029: public class ClassInner extends Class {
030:
031: // ------------------------------------------------------------------------
032: // --- field ---
033: // ------------------------------------------------------------------------
034:
035: /**
036: */
037: public Vector myClass;
038:
039: // ------------------------------------------------------------------------
040: // --- constructor ---
041: // ------------------------------------------------------------------------
042:
043: /**
044: * Creates a new instance of ClassInner.
045: */
046: public ClassInner() {
047: super ();
048: }
049:
050: // ------------------------------------------------------------------------
051: // --- methods ---
052: // ------------------------------------------------------------------------
053:
054: /**
055: * Sets the class within which this SourceObjectDeclared is declared.
056: */
057: public void setDeclaringClass(Class declaring) {
058: super .setDeclaringClass(declaring);
059: setPackage(declaring.getPackage());
060: myImport = declaring.myImport;
061: }
062:
063: /**
064: * Returns the name.
065: */
066: public String getName() {
067: return getDeclaringClass().getName() + "."
068: + getUnqualifiedName();
069: }
070:
071: /**
072: * Gets the unqualified name of this, that means the name without any leading package information.
073: */
074: public String getUnqualifiedName() {
075: return unqualify(name);
076: }
077:
078: /**
079: * Output this object as XML.
080: *
081: * @return The XML tag.
082: * @see #initFromXML
083: */
084: public Element buildXML(Document d) {
085: Element e = super .buildXML(d);
086: Element outer = d.createElement("outerclass");
087: outer.appendChild(d.createTextNode(getDeclaringClass()
088: .getName()));
089: e.appendChild(outer);
090: return e;
091: }
092:
093: /**
094: * Fully qualifies a class identifier, taking into account the current
095: * package of this class and the import statements.
096: *
097: * @return The fully qualified class identifier.
098: */
099: protected String qualifyInternal(String name) {
100: String q = super .qualifyInternal(name);
101: if (q == null) {
102: q = getDeclaringClass().qualifyInternal(name); // will also find inner classes of this
103: }
104: return q;
105: }
106:
107: protected void registerAtPackage(Package p) {
108: // overwrites Class.registerAtPackage
109: // nop
110: }
111:
112: } // end ClassInner
|