KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > modules > ruby > elements > AstClassElement


1 package org.netbeans.modules.ruby.elements;
2
3 import java.util.Set JavaDoc;
4 import org.jruby.ast.ClassNode;
5 import org.jruby.ast.Colon2Node;
6 import org.jruby.ast.Node;
7 import org.netbeans.api.gsf.ElementKind;
8
9
10 public class AstClassElement extends AstElement implements ClassElement {
11     private String JavaDoc fqn;
12     private Set JavaDoc<String JavaDoc> includes;
13     
14     public AstClassElement(Node node) {
15         super(node);
16     }
17
18     @Override JavaDoc
19     public String JavaDoc getName() {
20         if (name == null) {
21             if (node instanceof ClassNode) {
22                 Node n = ((ClassNode)node).getCPath();
23
24                 if (n instanceof Colon2Node) {
25                     Colon2Node c2n = (Colon2Node)n;
26                     name = c2n.getName();
27                 } else {
28                     name = n.toString();
29                 }
30             }
31
32             if (name == null) {
33                 name = node.toString();
34             }
35         }
36
37         return name;
38     }
39
40     public String JavaDoc getFqn() {
41         if (fqn == null) {
42             return getName();
43         }
44         return fqn;
45     }
46     
47     public void setFqn(String JavaDoc fqn) {
48         this.fqn = fqn;
49     }
50     
51     public void setIncludes(Set JavaDoc<String JavaDoc> includes) {
52         this.includes = includes;
53     }
54     
55     public Set JavaDoc<String JavaDoc> getIncludes() {
56         return includes;
57     }
58
59     @Override JavaDoc
60     public ElementKind getKind() {
61         return ElementKind.CLASS;
62     }
63 }
64
Popular Tags