View Javadoc

1   /*
2    * Copyright (c) 2001-2003 The XDoclet team
3    * All rights reserved.
4    */
5   package xjavadoc;
6   
7   import java.lang.reflect.Modifier;
8   
9   /***
10   * This implementation of XClass is used for classes that can't be resolved from
11   * either source or classpath (binary classes). It's useful for XDocletImpl,
12   * especially when classes refer to classes that are going to be generated by
13   * XDocletImpl.
14   *
15   * @author    Ara Abrahamian
16   * @author    Aslak Hellesøy
17   * @created   February 17, 2002
18   */
19  final class UnknownClass extends AbstractClass
20  {
21  
22  	public static int  instanceCount = 0;
23  
24  	/***
25  	 * @param qualifiedName
26  	 * @todo                 We're setting super to java.lang.Object, but if an
27  	 *      instance represents an unknown interface, then the superclass should be
28  	 *      null. How do we know whether an instance represents a class or an
29  	 *      interface? (Aslak)
30  	 */
31  	public UnknownClass( XJavaDoc xJavaDoc, String qualifiedName )
32  	{
33  		super( xJavaDoc, null );
34  		setQualifiedName( qualifiedName );
35  		// We don't know what our superclass is, so we'll set it to java.lang.Object to avoid NPE.
36  		setSuperclass( "java.lang.Object" );
37  
38  		addModifier( Modifier.PUBLIC );
39  		instanceCount++;
40  	}
41  
42  	/***
43  	 * whether this class can be saved ( it cannot )
44  	 *
45  	 * @return   false since this class can not be saved
46  	 */
47  	public boolean isWriteable()
48  	{
49  		return false;
50  	}
51  
52  	public boolean isPrimitive()
53  	{
54  		return false;
55  	}
56  
57  	/***
58  	 * no op for sake of interface implementation
59  	 */
60  	public void setDirty()
61  	{
62  	}
63  
64  	/***
65  	 * this class is not intended to be saved
66  	 *
67  	 * @return   always false
68  	 */
69  	public boolean saveNeeded()
70  	{
71  		return false;
72  	}
73  
74  }