01: /*
02: * Project: BeautyJ - Customizable Java Source Code Transformer
03: * Class: de.gulden.util.javasource.ImportClass
04: * Version: 1.0
05: *
06: * Date: 2002-10-27
07: *
08: * Note: Contains auto-generated Javadoc comments created by BeautyJ.
09: *
10: * This is licensed under the GNU General Public License (GPL)
11: * and comes with NO WARRANTY. See file license.txt for details.
12: *
13: * Author: Jens Gulden
14: * Email: beautyj@jensgulden.de
15: */
16:
17: package de.gulden.util.javasource;
18:
19: import de.gulden.util.xml.XMLToolbox;
20: import javax.xml.parsers.*;
21: import org.w3c.dom.*;
22: import java.io.*;
23: import java.util.*;
24:
25: /**
26: * Class ImportClass.
27: *
28: * @author Jens Gulden
29: * @version 1.0
30: */
31: public class ImportClass extends Import {
32:
33: // ------------------------------------------------------------------------
34: // --- constructors ---
35: // ------------------------------------------------------------------------
36: /**
37: * Creates a new instance of ImportClass.
38: */
39: public ImportClass(Package parent) {
40: super (parent);
41: }
42:
43: /**
44: * Creates a new instance of ImportClass.
45: */
46: ImportClass(Package parent, String name) {
47: this (parent);
48: setName(name);
49: }
50:
51: // ------------------------------------------------------------------------
52: // --- methods ---
53: // ------------------------------------------------------------------------
54: /**
55: * Fully qualifies a class identifier, if it matches the import statement.
56: *
57: * @return The qualified class identifier, or <code>null</code> if the identifer could not be qualified by this import.
58: */
59: public String qualify(String name) {
60: if (this .getName().endsWith("." + name)) {
61: return this .getName();
62: } else {
63: return null;
64: }
65: }
66:
67: /**
68: * Output this object as XML.
69: *
70: * @return The XML tag.
71: * @see #initFromXML
72: */
73: public Element buildXML(Document d) {
74: Element e = super .buildXML(d);
75: e.setAttribute("kind", "class");
76: return e;
77: }
78:
79: } // end ImportClass
|