1 18 package org.apache.beehive.netui.compiler.xdoclet.typesystem.impl.declaration; 19 20 import org.apache.beehive.netui.compiler.typesystem.declaration.ClassDeclaration; 21 import org.apache.beehive.netui.compiler.typesystem.declaration.ConstructorDeclaration; 22 import org.apache.beehive.netui.compiler.xdoclet.typesystem.impl.WrapperFactory; 23 import org.apache.beehive.netui.compiler.typesystem.type.ClassType; 24 25 import java.util.Collection ; 26 import java.util.Iterator ; 27 import java.util.List ; 28 import java.util.Collections ; 29 30 import xjavadoc.XClass; 31 import xjavadoc.XConstructor; 32 import xjavadoc.XPackage; 33 import xjavadoc.XDoc; 34 import xjavadoc.XProgramElement; 35 import xjavadoc.XJavaDoc; 36 37 public class ClassDeclarationImpl 38 extends TypeDeclarationImpl 39 implements ClassDeclaration 40 { 41 private ConstructorDeclaration[] _constructors; 42 43 public ClassDeclarationImpl( XClass delegate ) 44 { 45 super( delegate ); 46 } 47 48 public ClassType getSuperclass() 49 { 50 return WrapperFactory.get().getClassType( getDelegateXClass().getSuperclass() ); 51 } 52 53 public ConstructorDeclaration[] getConstructors() 54 { 55 if ( _constructors == null ) 56 { 57 Collection delegateCollection = getDelegateXClass().getConstructors(); 58 ConstructorDeclaration[] array = new ConstructorDeclaration[delegateCollection.size()]; 59 int j = 0; 60 for ( Iterator i = delegateCollection.iterator(); i.hasNext(); ) 61 { 62 array[j++] = WrapperFactory.get().getConstructorDeclaration( ( XConstructor ) i.next() ); 63 } 64 65 if ( array.length == 0 ) 66 { 67 XConstructor ctor = new DefaultConstructor( getDelegateXClass() ); 68 ConstructorDeclaration decl = WrapperFactory.get().getConstructorDeclaration( ctor ); 69 _constructors = new ConstructorDeclaration[]{ decl }; 70 } 71 else 72 { 73 _constructors = array; 74 } 75 } 76 77 return _constructors; 78 } 79 80 protected XClass getDelegateXClass() 81 { 82 return ( XClass ) super.getDelegate(); 83 } 84 85 private static class DefaultConstructor 86 implements XConstructor 87 { 88 private XClass _containingClass; 89 90 public DefaultConstructor( XClass containingClass ) 91 { 92 _containingClass = containingClass; 93 } 94 95 public boolean isNative() 96 { 97 return false; 98 } 99 100 public boolean isSynchronized() 101 { 102 return false; 103 } 104 105 public List getParameters() 106 { 107 return Collections.EMPTY_LIST; 108 } 109 110 public List getThrownExceptions() 111 { 112 assert false : "NYI"; 113 throw new UnsupportedOperationException ( "NYI" ); 114 } 115 116 public boolean throwsException( String s ) 117 { 118 return false; 119 } 120 121 public boolean isConstructor() 122 { 123 return true; 124 } 125 126 public String getSignature( boolean b ) 127 { 128 assert false : "NYI"; 129 throw new UnsupportedOperationException ( "NYI" ); 130 } 131 132 public String getNameWithSignature( boolean b ) 133 { 134 assert false : "NYI"; 135 throw new UnsupportedOperationException ( "NYI" ); 136 } 137 138 public String getParameterTypes() 139 { 140 assert false : "NYI"; 141 throw new UnsupportedOperationException ( "NYI" ); 142 } 143 144 public XClass getContainingClass() 145 { 146 return _containingClass; 147 } 148 149 public XPackage getContainingPackage() 150 { 151 return _containingClass.getContainingPackage(); 152 } 153 154 public boolean isFinal() 155 { 156 return false; 157 } 158 159 public boolean isPackagePrivate() 160 { 161 return false; 162 } 163 164 public boolean isPrivate() 165 { 166 return false; 167 } 168 169 public boolean isProtected() 170 { 171 return false; 172 } 173 174 public boolean isAbstract() 175 { 176 return false; 177 } 178 179 public boolean isPublic() 180 { 181 return true; 182 } 183 184 public boolean isStatic() 185 { 186 return false; 187 } 188 189 public String getModifiers() 190 { 191 return "public"; 192 } 193 194 public int getModifierSpecifier() 195 { 196 assert false : "NYI"; 197 throw new UnsupportedOperationException ( "NYI" ); 198 } 199 200 public XDoc getDoc() 201 { 202 return null; 203 } 204 205 public XProgramElement getSuperElement() 206 { 207 assert false : "NYI"; 208 throw new UnsupportedOperationException ( "NYI" ); 209 } 210 211 public List getSuperInterfaceElements() 212 { 213 assert false : "NYI"; 214 throw new UnsupportedOperationException ( "NYI" ); 215 } 216 217 public XJavaDoc getXJavaDoc() 218 { 219 assert false : "NYI"; 220 throw new UnsupportedOperationException ( "NYI" ); 221 } 222 223 public void updateDoc() 224 { 225 assert false : "NYI"; 226 throw new UnsupportedOperationException ( "NYI" ); 227 } 228 229 public int compareTo( Object o ) 230 { 231 assert false : "NYI"; 232 throw new UnsupportedOperationException ( "NYI" ); 233 } 234 235 public String getName() 236 { 237 assert false : "NYI"; 238 throw new UnsupportedOperationException ( "NYI" ); 239 } 240 } 241 } 242 | Popular Tags |