KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > de > gulden > util > javasource > ImportClass


1 /*
2  * Project: BeautyJ - Customizable Java Source Code Transformer
3  * Class: de.gulden.util.javasource.ImportClass
4  * Version: 1.0
5  *
6  * Date: 2002-10-27
7  *
8  * Note: Contains auto-generated Javadoc comments created by BeautyJ.
9  *
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 JavaDoc parent) {
40         super(parent);
41     }
42
43     /**
44      * Creates a new instance of ImportClass.
45      */

46     ImportClass(Package JavaDoc parent, String JavaDoc name) {
47         this(parent);
48         setName(name);
49     }
50
51
52     // ------------------------------------------------------------------------
53
// --- methods ---
54
// ------------------------------------------------------------------------
55
/**
56      * Fully qualifies a class identifier, if it matches the import statement.
57      *
58      * @return The qualified class identifier, or <code>null</code> if the identifer could not be qualified by this import.
59      */

60     public String JavaDoc qualify(String JavaDoc name) {
61         if (this.getName().endsWith("."+name)) {
62             return this.getName();
63         } else {
64             return null;
65         }
66     }
67
68     /**
69      * Output this object as XML.
70      *
71      * @return The XML tag.
72      * @see #initFromXML
73      */

74     public Element buildXML(Document d) {
75         Element e=super.buildXML(d);
76         e.setAttribute("kind","class");
77         return e;
78     }
79
80 } // end ImportClass
81
Popular Tags