01: package com.sun.codemodel;
02:
03: import java.util.Iterator;
04: import java.util.List;
05: import java.util.Collections;
06:
07: /**
08: * A special {@link JClass} that represents an unknown class (except its name.)
09: *
10: * @author Kohsuke Kawaguchi
11: * @see JCodeModel#directClass(String)
12: */
13: final class JDirectClass extends JClass {
14:
15: private final String fullName;
16:
17: public JDirectClass(JCodeModel _owner, String fullName) {
18: super (_owner);
19: this .fullName = fullName;
20: }
21:
22: public String name() {
23: int i = fullName.lastIndexOf('.');
24: if (i >= 0)
25: return fullName.substring(i + 1);
26: return fullName;
27: }
28:
29: public String fullName() {
30: return fullName;
31: }
32:
33: public JPackage _package() {
34: int i = fullName.lastIndexOf('.');
35: if (i >= 0)
36: return owner()._package(fullName.substring(0, i));
37: else
38: return owner().rootPackage();
39: }
40:
41: public JClass _extends() {
42: return owner().ref(Object.class);
43: }
44:
45: public Iterator<JClass> _implements () {
46: return Collections.<JClass> emptyList().iterator();
47: }
48:
49: public boolean isInterface() {
50: return false;
51: }
52:
53: public boolean isAbstract() {
54: return false;
55: }
56:
57: protected JClass substituteParams(JTypeVar[] variables,
58: List<JClass> bindings) {
59: return this;
60: }
61: }
|