Changeset 71
- Timestamp:
- 09/21/09 13:16:45 (2 years ago)
- Files:
-
- trunk (modified) (1 prop)
- trunk/asdoclet.ipr (modified) (3 diffs)
- trunk/build.xml (added)
- trunk/lib/ant.contrib.jar (added)
- trunk/lib/commons.collections.jar (added)
- trunk/lib/commons.lang.jar (added)
- trunk/lib/logback.classic.jar (added)
- trunk/lib/logback.core.jar (added)
- trunk/lib/tools.jar (deleted)
- trunk/lib/velocity-dep.jar (deleted)
- trunk/lib/velocity.jar (added)
- trunk/src/org/fluffnstuff/asdoclet/AsDoclet.java (modified) (4 diffs)
- trunk/src/org/fluffnstuff/asdoclet/generator/AsGenerator.java (modified) (20 diffs)
- trunk/src/org/fluffnstuff/asdoclet/generator/Generator.java (modified) (6 diffs)
- trunk/src/org/fluffnstuff/asdoclet/generator/VelocityGenerator.java (modified) (15 diffs)
- trunk/src/org/fluffnstuff/asdoclet/generator/utils/GeneratorUtils.java (modified) (5 diffs)
- trunk/src/org/fluffnstuff/asdoclet/generator/velocity/MethodDescriptor.java (modified) (2 diffs)
- trunk/src/org/fluffnstuff/asdoclet/handler/AbstractHandler.java (modified) (5 diffs)
- trunk/src/org/fluffnstuff/asdoclet/handler/ClassHandler.java (modified) (2 diffs)
- trunk/src/org/fluffnstuff/asdoclet/handler/EnumHandler.java (modified) (3 diffs)
- trunk/src/org/fluffnstuff/asdoclet/handler/Handler.java (modified) (1 diff)
- trunk/src/org/fluffnstuff/asdoclet/handler/InterfaceHandler.java (modified) (5 diffs)
- trunk/templates (added)
- trunk/templates/cs (added)
- trunk/templates/cs/class.vm (added)
- trunk/templates/cs/enum.vm (added)
- trunk/templates/cs/interface.vm (added)
- trunk/templates/cs/macros.vm (added)
- trunk/templates/cs/proxy.vm (added)
- trunk/test (added)
- trunk/test/TestAsdoclet.java (added)
- trunk/test/asdoclet (added)
- trunk/test/asdoclet/test (added)
- trunk/test/asdoclet/test/TestClassAnnotations.java (added)
- trunk/test/asdoclet/test/TestException.java (added)
- trunk/test/asdoclet/test/TestIgnoreClass.java (added)
- trunk/test/asdoclet/test/TestIgnoreInClass.java (added)
- trunk/test/asdoclet/test/TestIgnoreInClassBase.java (added)
- trunk/test/asdoclet/test/TestIgnoreInInterface.java (added)
- trunk/test/asdoclet/test/TestIgnoreInInterfaceBase.java (added)
- trunk/test/asdoclet/test/TestIgnoreInterface.java (added)
- trunk/test/asdoclet/test/TestInterfaceAnnotations.java (added)
- trunk/test/asdoclet/test/TestOverrideClass.class (added)
- trunk/test/asdoclet/test/TestOverrideClass.java (added)
- trunk/test/asdoclet/test/TestOverrideClassBase.class (added)
- trunk/test/asdoclet/test/TestOverrideClassBase.java (added)
- trunk/test/asdoclet/test/TestOverrideInterface.class (added)
- trunk/test/asdoclet/test/TestOverrideInterface.java (added)
- trunk/test/asdoclet/test/TestOverrideInterfaceBase.class (added)
- trunk/test/asdoclet/test/TestOverrideInterfaceBase.java (added)
- trunk/test/expectations (added)
- trunk/test/expectations/actionscript (added)
- trunk/test/expectations/actionscript/asdoclet (added)
- trunk/test/expectations/actionscript/asdoclet/test (added)
- trunk/test/expectations/actionscript/asdoclet/test/TestClassAnnotations.as (added)
- trunk/test/expectations/actionscript/asdoclet/test/TestException.as (added)
- trunk/test/expectations/actionscript/asdoclet/test/TestIgnoreClass.as (added)
- trunk/test/expectations/actionscript/asdoclet/test/TestIgnoreInClass.as (added)
- trunk/test/expectations/actionscript/asdoclet/test/TestIgnoreInClassBase.as (added)
- trunk/test/expectations/actionscript/asdoclet/test/TestIgnoreInInterface.as (added)
- trunk/test/expectations/actionscript/asdoclet/test/TestIgnoreInInterfaceBase.as (added)
- trunk/test/expectations/actionscript/asdoclet/test/TestIgnoreInterface.as (added)
- trunk/test/expectations/actionscript/asdoclet/test/TestInterfaceAnnotations.as (added)
- trunk/test/expectations/actionscript/asdoclet/test/TestOverrideClass.as (added)
- trunk/test/expectations/actionscript/asdoclet/test/TestOverrideClassBase.as (added)
- trunk/test/expectations/actionscript/asdoclet/test/TestOverrideInterface.as (added)
- trunk/test/expectations/actionscript/asdoclet/test/TestOverrideInterfaceBase.as (added)
- trunk/test/expectations/cs (added)
- trunk/test/expectations/cs/asdoclet (added)
- trunk/test/expectations/cs/asdoclet/test (added)
- trunk/test/expectations/cs/asdoclet/test/TestClassAnnotations.cs (added)
- trunk/test/expectations/cs/asdoclet/test/TestException.cs (added)
- trunk/test/expectations/cs/asdoclet/test/TestIgnoreClass.cs (added)
- trunk/test/expectations/cs/asdoclet/test/TestIgnoreInClass.cs (added)
- trunk/test/expectations/cs/asdoclet/test/TestIgnoreInClassBase.cs (added)
- trunk/test/expectations/cs/asdoclet/test/TestIgnoreInInterface.cs (added)
- trunk/test/expectations/cs/asdoclet/test/TestIgnoreInInterfaceBase.cs (added)
- trunk/test/expectations/cs/asdoclet/test/TestIgnoreInterface.cs (added)
- trunk/test/expectations/cs/asdoclet/test/TestInterfaceAnnotations.cs (added)
- trunk/test/expectations/cs/asdoclet/test/TestOverrideClass.cs (added)
- trunk/test/expectations/cs/asdoclet/test/TestOverrideClassBase.cs (added)
- trunk/test/expectations/cs/asdoclet/test/TestOverrideInterface.cs (added)
- trunk/test/expectations/cs/asdoclet/test/TestOverrideInterfaceBase.cs (added)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk
- Property svn:ignore changed from
*.iml
*.iws
*.jar
test
sample
to
*.iws
*.jar
*.iml
- Property svn:ignore changed from
trunk/asdoclet.ipr
r66 r71 3 3 <component name="AntConfiguration"> 4 4 <defaultAnt bundledAnt="true" /> 5 <buildFile url="file://$PROJECT_DIR$/build.xml"> 6 <additionalClassPath /> 7 <antReference projectDefault="true" /> 8 <customJdkName value="" /> 9 <maximumHeapSize value="128" /> 10 <maximumStackSize value="32" /> 11 <properties /> 12 </buildFile> 5 13 </component> 6 14 <component name="BuildJarProjectSettings"> … … 290 298 </modules> 291 299 </component> 292 <component name="ProjectRootManager" version="2" languageLevel="JDK_1_6" assert-keyword="true" jdk-15="true" project-jdk-name="1.6 " project-jdk-type="JavaSDK">300 <component name="ProjectRootManager" version="2" languageLevel="JDK_1_6" assert-keyword="true" jdk-15="true" project-jdk-name="1.6.0.16" project-jdk-type="JavaSDK"> 293 301 <output url="file://$PROJECT_DIR$/out" /> 294 302 </component> … … 507 515 </CLASSES> 508 516 <JAVADOC /> 509 <SOURCES> 510 <root url="file://C:/Users/harald/Documents/Development/metaas/src/main/java" /> 511 </SOURCES> 517 <SOURCES /> 512 518 <jarDirectory url="file://$PROJECT_DIR$/lib" recursive="false" /> 513 519 </library> trunk/src/org/fluffnstuff/asdoclet/AsDoclet.java
r64 r71 2 2 3 3 import java.lang.annotation.Annotation; 4 import java.util.Arrays; 4 5 5 6 import org.fluffnstuff.asdoclet.generator.AsGenerator; … … 26 27 private static final String PARAM_MAP = "-map"; 27 28 private static final String PARAM_GENERIC_MAP = "-genericmap"; 28 private static final String PARAM_ANNOTATION_MAP = "-annotationmap"; 29 private static final String PARAM_ANNOTATION_MAP = "-annotation"; 30 private static final String PARAM_ANNOTATION_TYPE_MAP = "-annotationmap"; 29 31 30 32 public static boolean start(RootDoc root) throws Exception { … … 55 57 ClassTypeMap typeMap = new ClassTypeMap(); 56 58 TypeMap annotationMap = new TypeMap(); 59 TypeMap annotationTypeMap = new TypeMap(); 57 60 58 61 for (String[] opt : options) { 59 if (opt[0].equals(PARAM_DESTINATION)) destination = opt[1]; 60 if (opt[0].equals(PARAM_NAMESPACE)) namespace = opt[1]; 61 if (opt[0].equals(PARAM_GENERATOR)) generator = opt[1]; 62 if (opt[0].equals(PARAM_ENUM)) enumAnnotation = (Class<? extends Annotation>) Class.forName(opt[1]); 63 if (opt[0].equals(PARAM_MAP)) { 62 if (opt[0].equals(PARAM_DESTINATION)) { 63 destination = opt[1]; 64 } else if (opt[0].equals(PARAM_NAMESPACE)) { 65 namespace = opt[1]; 66 } else if (opt[0].equals(PARAM_GENERATOR)) { 67 generator = opt[1]; 68 } else if (opt[0].equals(PARAM_ENUM)) { 69 enumAnnotation = (Class<? extends Annotation>) Class.forName(opt[1]); 70 } else if (opt[0].equals(PARAM_MAP)) { 64 71 String[] strings = opt[1].split(":"); 65 72 if (strings.length == 2) typeMap.addTypeMapping(strings[0], strings[1]); 66 } 67 if (opt[0].equals(PARAM_GENERIC_MAP)) { 73 } else if (opt[0].equals(PARAM_GENERIC_MAP)) { 68 74 String[] strings = opt[1].split(":"); 69 75 if (strings.length == 2) typeMap.addGenericTypeMapping(strings[0], strings[1]); 70 } 71 if (opt[0].equals(PARAM_ANNOTATION_MAP)) { 76 } else if (opt[0].equals(PARAM_ANNOTATION_MAP)) { 72 77 String[] strings = opt[1].split(":"); 73 78 if (strings.length == 2) annotationMap.addTypeMapping(strings[0], strings[1]); 79 } else if (opt[0].equals(PARAM_ANNOTATION_TYPE_MAP)) { 80 String[] strings = opt[1].split(":"); 81 if (strings.length == 2) annotationTypeMap.addTypeMapping(strings[0], strings[1]); 74 82 } 75 83 } 76 84 77 85 if ("actionscript".equals(generator)) { 78 return new AsGenerator(destination, namespace, enumAnnotation, typeMap, annotation Map);86 return new AsGenerator(destination, namespace, enumAnnotation, typeMap, annotationTypeMap, annotationMap); 79 87 } else if ("cs".equals(generator)) { 80 return new VelocityGenerator(destination, namespace, "cs", enumAnnotation, typeMap, annotation Map);88 return new VelocityGenerator(destination, namespace, "cs", enumAnnotation, typeMap, annotationTypeMap, annotationMap); 81 89 } 82 90 return null; … … 100 108 int length = 0; 101 109 102 if (PARAM_DESTINATION.equals(option)) length = 2; 103 if (PARAM_NAMESPACE.equals(option)) length = 2; 104 if (PARAM_GENERATOR.equals(option)) length = 2; 105 if (PARAM_ENUM.equals(option)) length = 2; 106 if (PARAM_MAP.equals(option)) length = 2; 107 if (PARAM_GENERIC_MAP.equals(option)) length = 2; 108 if (PARAM_ANNOTATION_MAP.equals(option)) length = 2; 110 if (Arrays.asList( 111 PARAM_DESTINATION, 112 PARAM_NAMESPACE, 113 PARAM_GENERATOR, 114 PARAM_ENUM, 115 PARAM_MAP, 116 PARAM_GENERIC_MAP, 117 PARAM_ANNOTATION_MAP, 118 PARAM_ANNOTATION_TYPE_MAP 119 ).contains(option)) length = 2; 109 120 110 121 return length; trunk/src/org/fluffnstuff/asdoclet/generator/AsGenerator.java
r68 r71 39 39 private ASMethod proxyMethod; 40 40 41 private final TypeMap annotationMap; 42 private final TypeMap annotationTypeMap; 41 43 private final TypeMap typeMap; 42 private final TypeMap annotationMap;43 44 private final Class<? extends Annotation> enumAnnotation; 44 45 … … 46 47 private Collection<String> proxyImports; 47 48 48 public AsGenerator(String destination, String namespace, Class<? extends Annotation> enumAnnotation, TypeMap typeMap, TypeMap annotationMap) { 49 public AsGenerator(String destination, String namespace, Class<? extends Annotation> enumAnnotation, TypeMap typeMap, TypeMap annotationTypeMap, TypeMap annotationMap) { 50 this.enumAnnotation = enumAnnotation; 49 51 this.typeMap = typeMap; 52 this.annotationTypeMap = annotationTypeMap; 50 53 this.annotationMap = annotationMap; 51 this.enumAnnotation = enumAnnotation;52 54 53 55 project = factory.newEmptyASProject(destination); … … 57 59 58 60 private void initTypeMap() { 61 annotationMap.addTypeMapping("java.lang.Deprecated", "Deprecated"); 62 59 63 typeMap.setEnumType("String"); 60 64 … … 87 91 } 88 92 93 @Override 89 94 public TypeMap getAnnotationMap() { 90 95 return annotationMap; 91 96 } 92 97 98 @Override 99 public TypeMap getAnnotationTypeMap() { 100 return annotationTypeMap; 101 } 102 103 @Override 93 104 public Class<? extends Annotation> getEnumAnnotation() { 94 105 return enumAnnotation; 95 106 } 96 107 108 @Override 97 109 public TypeMap getTypeMap() { 98 110 return typeMap; … … 101 113 // --------------------- Interface Generator --------------------- 102 114 115 @Override 116 public void addAnnotation(Type tag) { 117 if (method != null) { 118 method.newMetaTag(tag.getName()); 119 } else { 120 type.newMetaTag(tag.getName()); 121 } 122 } 123 124 @Override 103 125 public void addBody(String body) { 104 126 } 105 127 128 @Override 106 129 public void addConstant(Type classType, Type constantType, String name, String initializer, String comment) { 107 130 createConst((ASClassType) type, name, initializer, constantType.getName(), comment); 108 131 } 109 132 133 @Override 110 134 public void addEnumField(Type classType, Type fieldType, String name, Object value, String comment) { 111 135 if (value == null) value = name; … … 114 138 } 115 139 140 @Override 116 141 public void addField(Type classType, int modifier, Type fieldType, String fieldName, Object value, String comment) { 117 142 fieldType = resolveTypeArguments(classType, null, fieldType); … … 121 146 } 122 147 123 public void addGetter(Type classType, Type methodType, int modifier, Type fieldType, String propertyName, String comment, boolean override) { 148 @Override 149 public void beginGetter(Type classType, Type methodType, int modifier, Type fieldType, String propertyName, String comment, boolean override) { 124 150 fieldType = resolveTypeArguments(classType, methodType, fieldType); 125 151 126 152 if (type instanceof ASClassType) { 127 153 addField(classType, Modifier.PRIVATE, fieldType, "_" + propertyName, null, null); 128 beginMethod(classType, Type.EMPTY, modifier, fieldType, "get " + propertyName, false); 129 method.setOverride(override); 154 beginMethod(classType, Type.EMPTY, modifier, fieldType, "get " + propertyName, false, override); 130 155 method.addStmt("return _" + propertyName + ";"); 131 156 } else { 132 beginMethod(classType, Type.EMPTY, modifier, fieldType, "get " + propertyName, false );157 beginMethod(classType, Type.EMPTY, modifier, fieldType, "get " + propertyName, false, override); 133 158 } 134 159 … … 136 161 } 137 162 163 @Override 138 164 public void addInterface(Type name) { 139 165 if (type instanceof ASInterfaceType) { … … 147 173 } 148 174 175 @Override 149 176 public void addParameter(Type classType, Type methodType, Type type, String name) { 150 177 type = resolveTypeArguments(classType, methodType, type); … … 156 183 } 157 184 158 public void addSetter(Type classType, Type methodType, int modifier, Type fieldType, String propertyName, String comment, boolean override) { 185 @Override 186 public void beginSetter(Type classType, Type methodType, int modifier, Type fieldType, String propertyName, String comment, boolean override) { 159 187 fieldType = resolveTypeArguments(classType, methodType, fieldType); 160 188 161 189 if (type instanceof ASClassType) { 162 190 addField(classType, Modifier.PRIVATE, fieldType, "_" + propertyName, null, null); 163 beginMethod(classType, Type.EMPTY, modifier, Type.VOID, "set " + propertyName, false); 164 method.setOverride(override); 191 beginMethod(classType, Type.EMPTY, modifier, Type.VOID, "set " + propertyName, false, override); 165 192 method.addParam("value", fieldType.getName()); 166 193 method.addStmt("_" + propertyName + "=value;"); 167 194 } else { 168 beginMethod(classType, Type.EMPTY, modifier, Type.VOID, "set " + propertyName, false );195 beginMethod(classType, Type.EMPTY, modifier, Type.VOID, "set " + propertyName, false, override); 169 196 method.addParam("value", fieldType.getName()); 170 197 } … … 173 200 } 174 201 175 public void addTypeAnnotation(Type tag) { 176 type.newMetaTag(tag.getName()); 177 } 178 202 @Override 179 203 public void beginClass(Type classType) { 180 204 System.out.println("Creating ActionScript class " + classType); 181 205 182 206 newClass(classType, false); 183 addTypeAnnotation(GeneratorUtils.getType("RemoteClass(alias=\"" + classType.getName() + "\")", this)); 184 } 185 207 addAnnotation(GeneratorUtils.getType("RemoteClass(alias=\"" + classType.getName() + "\")", this)); 208 } 209 210 @Override 186 211 public void beginEnum(Type name) { 187 212 System.out.println("Creating ActionScript enumeration " + name); … … 190 215 } 191 216 217 @Override 192 218 public void beginInterface(Type name) { 193 219 System.out.println("Creating ActionScript interface " + name); … … 198 224 } 199 225 200 public void beginMethod(Type classType, Type methodType, int modifier, Type returnType, String methodName, boolean asnyc) { 226 @Override 227 public void beginMethod(Type classType, Type methodType, int modifier, Type returnType, String methodName, boolean asnyc, boolean override) { 201 228 returnType = resolveTypeArguments(classType, methodType, returnType); 202 229 203 230 if (unit != null) { 204 231 method = type.newMethod(methodName, getVisibility(modifier), returnType.getName()); 232 method.setOverride(override); 205 233 } 206 234 … … 215 243 } 216 244 245 @Override 217 246 public void beginProxy(Type proxy, Type baseType, Type interfaceType) { 218 247 System.out.println("Creating ActionScript proxy " + proxy.getName()); … … 246 275 } 247 276 277 @Override 248 278 public void endClass() { 249 279 end(); 250 280 } 251 281 282 @Override 252 283 public void endEnum() { 253 284 end(); 254 285 } 255 286 287 @Override 288 public void endGetter() { 289 endMethod(Type.EMPTY); 290 } 291 292 @Override 256 293 public void endInterface() { 257 294 end(); 258 295 } 259 296 297 @Override 260 298 public void endMethod(Type asyncType) { 261 299 if (proxyUnit != null) { … … 279 317 } 280 318 319 @Override 281 320 public void endProxy() { 282 321 for (String imp : proxyImports) proxyUnit.getPackage().addImport(imp); … … 285 324 } 286 325 326 @Override 327 public void endSetter() { 328 endMethod(Type.EMPTY); 329 } 330 331 @Override 287 332 public void generate() throws IOException { 288 333 //project.performAutoImport(); // todo this is buggy … … 290 335 } 291 336 337 @Override 292 338 public String getName() { 293 339 return "actionscript"; 294 340 } 295 341 342 @Override 296 343 public boolean hasEnumSupport() { 297 344 return false; 298 345 } 299 346 347 @Override 300 348 public boolean isDebug() { 301 349 return false; 302 350 } 303 351 352 @Override 304 353 public Type postProcessType(Type type) { 305 354 if (type.getDimensions() > 0) return GeneratorUtils.getType(Collection.class.getCanonicalName(), this); … … 307 356 } 308 357 358 @Override 309 359 public void setMethodDescription(String description) { 310 360 if (unit != null && !StringUtils.isEmpty(description)) method.setDescription(description.trim()); 311 361 } 312 362 363 @Override 313 364 public void setSuperclass(Type name, boolean exception) { 314 365 ((ASClassType) type).setSuperclass(name.getName()); … … 316 367 } 317 368 369 @Override 318 370 public void setTypeDescription(String description) { 319 371 if (!StringUtils.isEmpty(description)) type.setDescription(description.trim()); trunk/src/org/fluffnstuff/asdoclet/generator/Generator.java
r68 r71 6 6 7 7 public interface Generator { 8 void addAnnotation(Type annotation); 9 8 10 void addBody(String body); 9 11 … … 14 16 void addField(Type classType, int modifier, Type fieldType, String fieldName, Object value, String comment); 15 17 16 void addGetter(Type classType, Type methodType, int modifier, Type fieldType, String propertyName, String comment, boolean override);18 void beginGetter(Type classType, Type methodType, int modifier, Type fieldType, String propertyName, String comment, boolean override); 17 19 18 20 void addInterface(Type type); … … 20 22 void addParameter(Type classType, Type methodType, Type type, String name); 21 23 22 void addSetter(Type classType, Type methodType, int modifier, Type fieldType, String propertyName, String comment, boolean override); 23 24 void addTypeAnnotation(Type annotation); 24 void beginSetter(Type classType, Type methodType, int modifier, Type fieldType, String propertyName, String comment, boolean override); 25 25 26 26 void beginClass(Type type); … … 30 30 void beginInterface(Type type); 31 31 32 void beginMethod(Type classType, Type methodType, int modifier, Type returnType, String methodName, boolean as ync);32 void beginMethod(Type classType, Type methodType, int modifier, Type returnType, String methodName, boolean asnyc, boolean override); 33 33 34 34 void beginProxy(Type type, Type baseType, Type interfaceType); … … 38 38 void endEnum(); 39 39 40 void endGetter(); 41 40 42 void endInterface(); 41 43 … … 44 46 void endProxy(); 45 47 48 void endSetter(); 49 46 50 void generate() throws Exception; 47 51 48 52 TypeMap getAnnotationMap(); 53 54 TypeMap getAnnotationTypeMap(); 49 55 50 56 Class<? extends Annotation> getEnumAnnotation(); trunk/src/org/fluffnstuff/asdoclet/generator/VelocityGenerator.java
r68 r71 8 8 import java.util.ArrayList; 9 9 import java.util.Collection; 10 import java.util.Map;11 10 12 11 import org.apache.commons.lang.StringUtils; … … 36 35 private FieldDescriptor fieldDescriptor; 37 36 private MethodDescriptor methodDescriptor; 37 private PropertyDescriptor propertyDescriptor; 38 38 39 39 private final File destination; … … 42 42 43 43 private final TypeMap annotationMap; 44 private final TypeMap annotationTypeMap; 44 45 private final TypeMap typeMap; 45 46 private final Class<? extends Annotation> enumAnnotation; 46 47 47 public VelocityGenerator(String destination, String namespace, String language, Class<? extends Annotation> enumAnnotation, TypeMap typeMap, TypeMap annotation Map) throws Exception {48 public VelocityGenerator(String destination, String namespace, String language, Class<? extends Annotation> enumAnnotation, TypeMap typeMap, TypeMap annotationTypeMap, TypeMap annotationMap) throws Exception { 48 49 this.destination = new File(destination); 49 50 this.namespace = namespace; 50 51 this.language = language; 51 52 53 this.enumAnnotation = enumAnnotation; 52 54 this.typeMap = typeMap; 55 this.annotationTypeMap = annotationTypeMap; 53 56 this.annotationMap = annotationMap; 54 this.enumAnnotation = enumAnnotation;55 57 56 58 Velocity.setProperty(Velocity.RUNTIME_LOG_LOGSYSTEM_CLASS, "org.fluffnstuff.asdoclet.generator.velocity.SLF4JLogChute"); … … 69 71 70 72 private void initCsTypeMap() { 73 annotationMap.addTypeMapping("java.lang.Deprecated", "System.Obsolete"); 74 71 75 typeMap.addTypeMapping("boolean", "bool"); 72 76 … … 97 101 } 98 102 103 @Override 99 104 public TypeMap getAnnotationMap() { 100 105 return annotationMap; 101 106 } 102 107 108 @Override 109 public TypeMap getAnnotationTypeMap() { 110 return annotationTypeMap; 111 } 112 113 @Override 103 114 public Class<? extends Annotation> getEnumAnnotation() { 104 115 return enumAnnotation; 105 116 } 106 117 118 @Override 107 119 public TypeMap getTypeMap() { 108 120 return typeMap; … … 111 123 // --------------------- Interface Generator --------------------- 112 124 125 @Override 126 public void addAnnotation(Type annotation) { 127 if (methodDescriptor != null) { 128 methodDescriptor.addAnnotation(annotation); 129 } else if (propertyDescriptor != null) { 130 propertyDescriptor.addAnnotation(annotation); 131 } else { 132 typeDescriptor.addAnnotation(annotation); 133 } 134 } 135 136 @Override 113 137 public void addBody(String body) { 114 138 methodDescriptor.addBody(body); 115 139 } 116 140 141 @Override 117 142 public void addConstant(Type classType, Type constantType, String name, String initializer, String comment) { 118 143 addField(classType, Modifier.STATIC, constantType, name, initializer, comment); 119 144 } 120 145 146 @Override 121 147 public void addEnumField(Type classType, Type fieldType, String name, Object value, String comment) { 122 148 addField(classType, 0, fieldType, name, value, comment); 123 149 } 124 150 151 @Override 125 152 public void addField(Type classType, int modifier, Type fieldType, String propertyName, Object value, String comment) { 126 153 fieldDescriptor = new FieldDescriptor(modifier, fieldType, propertyName, value); … … 130 157 } 131 158 132 public void addGetter(Type classType, Type methodType, int modifier, Type returnType, String propertyName, String description, boolean override) { 133 PropertyDescriptor propertyDescriptor = new PropertyDescriptor(modifier, returnType, methodType, propertyName); 159 @Override 160 public void beginGetter(Type classType, Type methodType, int modifier, Type returnType, String propertyName, String description, boolean override) { 161 propertyDescriptor = new PropertyDescriptor(modifier, returnType, methodType, propertyName); 134 162 propertyDescriptor.setGetter(true); 135 propertyDescriptor.setOverride( propertyDescriptor.isOverride() ||override);163 propertyDescriptor.setOverride(override); 136 164 propertyDescriptor.setDescription(description); 137 165 typeDescriptor.addPropertyDescriptor(propertyDescriptor); … … 142 170 } 143 171 172 @Override 144 173 public void addInterface(Type name) { 145 174 typeDescriptor.addInterface(name); 146 175 } 147 176 177 @Override 148 178 public void addParameter(Type classType, Type methodType, Type type, String name) { 149 179 ParameterDescriptor parameterDescriptor = new ParameterDescriptor(type, name); … … 151 181 } 152 182 153 public void addSetter(Type classType, Type methodType, int modifier, Type returnType, String propertyName, String description, boolean override) { 154 PropertyDescriptor propertyDescriptor = new PropertyDescriptor(modifier, returnType, methodType, propertyName); 183 @Override 184 public void beginSetter(Type classType, Type methodType, int modifier, Type returnType, String propertyName, String description, boolean override) { 185 propertyDescriptor = new PropertyDescriptor(modifier, returnType, methodType, propertyName); 155 186 propertyDescriptor.setSetter(true); 156 propertyDescriptor.setOverride( propertyDescriptor.isOverride() ||override);187 propertyDescriptor.setOverride(override); 157 188 propertyDescriptor.setDescription(description); 158 189 typeDescriptor.addPropertyDescriptor(propertyDescriptor); … … 163 194 } 164 195 165 public void addTypeAnnotation(Type annotation) { 166 typeDescriptor.addAnnotation(annotation); 167 } 168 196 @Override 169 197 public void beginClass(Type type) { 170 198 beginType(new ClassDescriptor(type)); 171 199 } 172 200 201 @Override 173 202 public void beginEnum(Type type) { 174 203 beginType(new EnumDescriptor(type)); 175 204 } 176 205 206 @Override 177 207 public void beginInterface(Type type) { 178 208 beginType(new InterfaceDescriptor(type)); 179 209 } 180 210 181 public void beginMethod(Type classType, Type methodType, int modifier, Type returnType, String methodName, boolean async) { 182 methodDescriptor = new MethodDescriptor(modifier, returnType, methodType, methodName, async); 211 @Override 212 public void beginMethod(Type classType, Type methodType, int modifier, Type returnType, String methodName, boolean asnyc, boolean override) { 213 methodDescriptor = new MethodDescriptor(modifier, returnType, methodType, methodName, asnyc); 214 methodDescriptor.setOverride(override); 183 215 if (typeDescriptor != null) typeDescriptor.addMethodDescriptor(methodDescriptor); 184 216 if (proxyTypeDescriptor != null) proxyTypeDescriptor.addMethodDescriptor(methodDescriptor); 185 217 } 186 218 219 @Override 187 220 public void beginProxy(Type proxy, Type baseType, Type interfaceType) { 188 221 proxyTypeDescriptor = new ProxyDescriptor(proxy); … … 194 227 } 195 228 229 @Override 196 230 public void endClass() { 197 231 typeDescriptor = null; 198 232 } 199 233 234 @Override 200 235 public void endEnum() { 201 236 typeDescriptor = null; 202 237 } 203 238 239 @Override 240 public void endGetter() { 241 propertyDescriptor = null; 242 } 243 244 @Override 204 245 public void endInterface() { 205 246 typeDescriptor = null; 206 247 } 207 248 249 @Override 208 250 public void endMethod(Type callbackType) { 209 251 if (callbackType != org.fluffnstuff.asdoclet.generator.Type.EMPTY) { … … 214 256 } 215 257 258 @Override 216 259 public void endProxy() { 217 260 proxyTypeDescriptor = null; 218 261 } 219 262 263 @Override 264 public void endSetter() { 265 propertyDescriptor = null; 266 } 267 268 @Override 220 269 public void generate() throws Exception { 221 270 for (TypeDescriptor descriptor : typeDescriptors) { 222 271 String ns = descriptor.getNameSpace(); 223 272 224 if (n s.indexOf(namespace) == 0) {273 if (namespace != null && ns.indexOf(namespace) == 0) { 225 274 ns = ns.substring(namespace.length()); 226 275 if (ns.startsWith(".")) ns = ns.substring(1); … … 244 293 } 245 294 295 @Override 246 296 public String getName() { 247 297 return language; 248 298 } 249 299 300 @Override 250 301 public boolean hasEnumSupport() { 251 302 return true; 252 303 } 253 304 305 @Override 254 306 public boolean isDebug() { 255 307 return false; 256 308 } 257 309 310 @Override 258 311 public Type postProcessType(Type type) { 259 312 return type; 260 313 } 261 314 315 @Override 262 316 public void setMethodDescription(String description) { 263 317 if (!StringUtils.isEmpty(description)) methodDescriptor.setDescription(description.trim()); 264 318 } 265 319 320 @Override 266 321 public void setSuperclass(Type type, boolean exception) { 267 322 ((ClassDescriptor) typeDescriptor).setSuperclass(type); 268 323 269 324 if (exception && CSHARP.equals(language)) { 270 beginMethod(type, Type.EMPTY, Modifier.PUBLIC, Type.EMPTY, typeDescriptor.getTypeName(), false );325 beginMethod(type, Type.EMPTY, Modifier.PUBLIC, Type.EMPTY, typeDescriptor.getTypeName(), false, false); 271 326 addBody(" : base() {}"); 272 327 endMethod(Type.EMPTY); 273 328 274 beginMethod(type, Type.EMPTY, Modifier.PUBLIC, Type.EMPTY, typeDescriptor.getTypeName(), false );329 beginMethod(type, Type.EMPTY, Modifier.PUBLIC, Type.EMPTY, typeDescriptor.getTypeName(), false, false); 275 330 addParameter(type, Type.EMPTY, GeneratorUtils.getType(String.class.getCanonicalName(), this), "message"); 276 331 addBody(" : base(message) {}"); 277 332 endMethod(Type.EMPTY); 278 333 279 beginMethod(type, Type.EMPTY, Modifier.PUBLIC, Type.EMPTY, typeDescriptor.getTypeName(), false );334 beginMethod(type, Type.EMPTY, Modifier.PUBLIC, Type.EMPTY, typeDescriptor.getTypeName(), false, false); 280 335 addParameter(type, Type.EMPTY, GeneratorUtils.getType(String.class.getCanonicalName(), this), "message"); 281 336 addParameter(type, Type.EMPTY, GeneratorUtils.getType(Exception.class.getCanonicalName(), this), "exception"); … … 285 340 } 286 341 342 @Override 287 343 public void setTypeDescription(String description) { 288 344 if (!StringUtils.isEmpty(description)) typeDescriptor.setDescription(description.trim()); … … 294 350 } 295 351 296 public void setBounds(Map<String, Type> bounds) {297 if (proxyTypeDescriptor != null) proxyTypeDescriptor.getBounds().putAll(bounds);298 }299 300 352 private void setFieldDescription(String description) { 301 353 if (!StringUtils.isEmpty(description)) fieldDescriptor.setDescription(description.trim()); trunk/src/org/fluffnstuff/asdoclet/generator/utils/GeneratorUtils.java
r64 r71 1 1 package org.fluffnstuff.asdoclet.generator.utils; 2 2 3 import java.lang.annotation.Annotation; 3 4 import java.text.MessageFormat; 4 5 import java.util.ArrayList; … … 8 9 import java.util.HashSet; 9 10 import java.util.Map; 10 import java.lang.annotation.Annotation;11 11 12 12 import org.fluffnstuff.asdoclet.generator.Generator; 13 13 import org.fluffnstuff.asdoclet.map.TypeMap; 14 14 15 import com.sun.javadoc.AnnotationDesc; 15 16 import com.sun.javadoc.ClassDoc; 16 17 import com.sun.javadoc.MethodDoc; … … 19 20 import com.sun.javadoc.TypeVariable; 20 21 import com.sun.javadoc.WildcardType; 21 import com.sun.javadoc.AnnotationDesc;22 22 23 23 public final class GeneratorUtils { 24 24 private static Map<String, org.fluffnstuff.asdoclet.generator.Type> enumerationTypes = new HashMap<String, org.fluffnstuff.asdoclet.generator.Type>(); 25 26 private static org.fluffnstuff.asdoclet.generator.Type getEnumerationType(Type enumerationType, Generator generator) {27 Class<? extends Annotation> enumAnnotation = generator.getEnumAnnotation();28 ClassDoc classDoc = enumerationType.asClassDoc();29 String typeName = enumerationType.qualifiedTypeName();30 31 if (generator.hasEnumSupport()) return org.fluffnstuff.asdoclet.generator.Type.EMPTY;32 if (enumerationTypes.containsKey(typeName)) return enumerationTypes.get(typeName);33 34 if (classDoc != null && enumAnnotation != null) {35 for (MethodDoc methodDoc : classDoc.methods()) {36 for (AnnotationDesc annotationDesc : methodDoc.annotations()) {37 if (annotationDesc.annotationType().qualifiedTypeName().equals(enumAnnotation.getCanonicalName())) {38 org.fluffnstuff.asdoclet.generator.Type type = GeneratorUtils.getType(methodDoc.returnType(), generator);39 enumerationTypes.put(typeName, type);40 return type;41 }42 }43 }44 45 enumerationTypes.put(typeName, org.fluffnstuff.asdoclet.generator.Type.EMPTY);46 }47 48 return org.fluffnstuff.asdoclet.generator.Type.EMPTY;49 }50 25 51 26 public static org.fluffnstuff.asdoclet.generator.Type getType(MethodDoc doc, Generator generator) { … … 113 88 } 114 89 90 private static org.fluffnstuff.asdoclet.generator.Type getEnumerationType(Type enumerationType, Generator generator) { 91 Class<? extends Annotation> enumAnnotation = generator.getEnumAnnotation(); 92 ClassDoc classDoc = enumerationType.asClassDoc(); 93 String typeName = enumerationType.qualifiedTypeName(); 94 95 if (generator.hasEnumSupport()) return org.fluffnstuff.asdoclet.generator.Type.EMPTY; 96 if (enumerationTypes.containsKey(typeName)) return enumerationTypes.get(typeName); 97 98 if (classDoc != null && enumAnnotation != null) { 99 for (MethodDoc methodDoc : classDoc.methods()) { 100 for (AnnotationDesc annotationDesc : methodDoc.annotations()) { 101 if (annotationDesc.annotationType().qualifiedTypeName().equals(enumAnnotation.getCanonicalName())) { 102 org.fluffnstuff.asdoclet.generator.Type type = GeneratorUtils.getType(methodDoc.returnType(), generator); 103 enumerationTypes.put(typeName, type); 104 return type; 105 } 106 } 107 } 108 109 enumerationTypes.put(typeName, org.fluffnstuff.asdoclet.generator.Type.EMPTY); 110 } 111 112 return org.fluffnstuff.asdoclet.generator.Type.EMPTY; 113 } 114 115 public static org.fluffnstuff.asdoclet.generator.Type getType(Type type, Generator generator) { 116 return getType(type, generator, new HashSet<String>()); 117 } 118 115 119 public static boolean isEnum(Type type) { 116 120 return type.asClassDoc() != null && type.asClassDoc().isEnum(); … … 150 154 } 151 155 152 public static org.fluffnstuff.asdoclet.generator.Type getType(Type type, Generator generator) {153 return getType(type, generator, new HashSet<String>());154 }155 156 156 public static org.fluffnstuff.asdoclet.generator.Type getType(String name, Generator generator) { 157 157 if (name == null) return org.fluffnstuff.asdoclet.generator.Type.NULL; 158 158 return getType(name, generator, generator.getTypeMap()); 159 } 160 161 public static org.fluffnstuff.asdoclet.generator.Type getAnnotationType(String name, Generator generator) { 162 return getType(name, generator, generator.getAnnotationTypeMap()); 159 163 } 160 164 trunk/src/org/fluffnstuff/asdoclet/generator/velocity/MethodDescriptor.java
r68 r71 9 9 private Collection<ParameterDescriptor> parameterDescriptors = new ArrayList<ParameterDescriptor>(); 10 10 private boolean async; 11 private boolean override; 11 12 private String body; 12 13 private Type genericType; … … 43 44 } 44 45 46 public boolean isOverride() { 47 return override; 48 } 49 50 public void setOverride(boolean override) { 51 this.override = override; 52 } 53 45 54 public void addBody(String body) { 46 55 this.body = body; trunk/src/org/fluffnstuff/asdoclet/handler/AbstractHandler.java
r64 r71 3 3 import java.beans.Introspector; 4 4 import java.lang.reflect.Modifier; 5 import java.lang.reflect.Method;6 import java.lang.annotation.Annotation;7 5 import java.util.HashMap; 8 6 import java.util.HashSet; … … 48 46 } 49 47 50 protected Set<String> getIgnore(Map<String, String> commands) {51 Set<String> ignore = new HashSet<String>();52 StringTokenizer tokenizer = new StringTokenizer(TagParser.getStringCommand(Constants.COMMAND_IGNORE, "", commands), ",;");53 while (tokenizer.hasMoreTokens()) ignore.add(tokenizer.nextToken());54 return ignore;55 }56 57 protected void processAnnotations(Map<String, String> commands) {58 if (commands.containsKey(Constants.COMMAND_ANNOTATION)) {59 StringTokenizer tokenizer = new StringTokenizer(commands.get(Constants.COMMAND_ANNOTATION), ",");60 while (tokenizer.hasMoreTokens()) {61 getGenerator().addTypeAnnotation(GeneratorUtils.getType(tokenizer.nextToken(), getGenerator()));62 }63 }64 }65 66 48 protected void processBeanProperty(ClassDoc classDoc, org.fluffnstuff.asdoclet.generator.Type classType, MethodDoc methodDoc, Set<String> ignore, Map<String, String> commands) { 67 Map<String, String> methodCommands = new HashMap<String, String>(commands); 68 TagParser.processTags(methodDoc.tags(getGenerator().getName() + Constants.TAG_PROPERTY), methodCommands); 69 70 if (!TagParser.getBooleanCommand(Constants.COMMAND_IGNORE, methodCommands)) { 49 Map<String, String> propertyCommands = new HashMap<String, String>(commands); 50 Map<String, String> propertyOnlyCommands = new HashMap<String, String>(); 51 52 TagParser.processTags(methodDoc.tags(getGenerator().getName() + Constants.TAG_PROPERTY), propertyOnlyCommands); 53 propertyCommands.putAll(propertyOnlyCommands); 54 55 if (!TagParser.getBooleanCommand(Constants.COMMAND_IGNORE, propertyCommands)) { 71 56 String propertyName = getBeanPropertyName(methodDoc); 72 57 if (propertyName != null) { 73 String overriddenType = TagParser.getStringCommand(Constants.COMMAND_TYPE, methodCommands);58 String overriddenType = TagParser.getStringCommand(Constants.COMMAND_TYPE, propertyCommands); 74 59 75 60 org.fluffnstuff.asdoclet.generator.Type fieldType = getFieldType(methodDoc, findField(classDoc, propertyName), overriddenType); … … 87 72 String setterName = "set" + propertyName.substring(0, 1).toUpperCase() + propertyName.substring(1); 88 73 89 90 74 if (classDoc.isInterface()) { 91 getGenerator().addGetter(classType, methodType, 0, fieldType, propertyName, comment, false); 92 if (findMethod(setterName, classDoc)) getGenerator().addSetter(classType, methodType, 0, fieldType, propertyName, comment, false); 75 getGenerator().beginGetter(classType, methodType, 0, fieldType, propertyName, comment, false); 76 processAnnotations(methodDoc.annotations()); 77 processAnnotationCommands(propertyOnlyCommands); 78 getGenerator().endGetter(); 79 80 if (findMethod(setterName, classDoc)) { 81 getGenerator().beginSetter(classType, methodType, 0, fieldType, propertyName, comment, false); 82 processAnnotations(methodDoc.annotations()); 83 processAnnotationCommands(propertyOnlyCommands); 84 getGenerator().endSetter(); 85 } 93 86 } else { 94 87 boolean overridden = isOverridden(classDoc, name, ignore); 95 getGenerator().addGetter(classType, methodType, Modifier.PUBLIC, fieldType, propertyName, comment, overridden); 88 89 getGenerator().beginGetter(classType, methodType, Modifier.PUBLIC, fieldType, propertyName, comment, overridden); 90 processAnnotations(methodDoc.annotations()); 91 processAnnotationCommands(propertyOnlyCommands); 92 getGenerator().endGetter(); 93 96 94 // always generate setter, serialization doesn't work otherwise 97 getGenerator().addSetter(classType, methodType, Modifier.PUBLIC, fieldType, propertyName, comment, overridden); 95 getGenerator().beginSetter(classType, methodType, Modifier.PUBLIC, fieldType, propertyName, comment, overridden); 96 processAnnotations(methodDoc.annotations()); 97 processAnnotationCommands(propertyOnlyCommands); 98 getGenerator().endSetter(); 98 99 } 99 100 } … … 133 134 for (AnnotationDesc annotationDesc : annotationDescs) { 134 135 AnnotationTypeDoc annotationTypeDoc = annotationDesc.annotationType(); 135 fieldType = GeneratorUtils.getAnnotation (annotationTypeDoc.qualifiedTypeName(), getGenerator());136 fieldType = GeneratorUtils.getAnnotationType(annotationTypeDoc.qualifiedTypeName(), getGenerator()); 136 137 if (fieldType != null) break; 137 138 } … … 161 162 } 162 163 163 private boolean isOverridden(ClassDoc classDoc, String name, Set<String> ignore) { 164 for (ClassDoc superClass = classDoc.superclass(); superClass != null; superClass = superClass.superclass()) { 165 if (ignore.contains(superClass.qualifiedTypeName() + "." + name)) return false; 166 if (ignore.contains(superClass.qualifiedTypeName())) return false; 167 if (findMethod(name, superClass)) return true; 164 protected boolean isOverridden(ClassDoc classDoc, String name, Set<String> ignore) { 165 if (classDoc.isInterface()) { 166 for (ClassDoc interfaceDoc : classDoc.interfaces()) { 167 if (ignore.contains(interfaceDoc.qualifiedTypeName() + "." + name)) return false; 168 if (ignore.contains(interfaceDoc.qualifiedTypeName())) return false; 169 if (findMethod(name, interfaceDoc)) return true; 170 171 Map<String, String> commands = TagParser.processClassTags(getGenerator(), interfaceDoc); 172 Set<String> interfaceIgnore = getIgnore(commands); 173 interfaceIgnore.addAll(ignore); 174 175 if (isOverridden(interfaceDoc, name, interfaceIgnore)) return true; 176 } 177 } else { 178 for (ClassDoc superClass = classDoc.superclass(); superClass != null; superClass = superClass.superclass()) { 179 if (ignore.contains(superClass.qualifiedTypeName() + "." + name)) return false; 180 if (ignore.contains(superClass.qualifiedTypeName())) return false; 181 if (findMethod(name, superClass)) return true; 182 183 Map<String, String> commands = TagParser.processClassTags(getGenerator(), superClass); 184 ignore.addAll(getIgnore(commands)); 185 } 168 186 } 169 187 return false; 188 } 189 190 protected Set<String> getIgnore(Map<String, String> commands) { 191 Set<String> ignore = new HashSet<String>(); 192 StringTokenizer tokenizer = new StringTokenizer(TagParser.getStringCommand(Constants.COMMAND_IGNORE, "", commands), ",;"); 193 while (tokenizer.hasMoreTokens()) ignore.add(tokenizer.nextToken()); 194 return ignore; 195 } 196 197 protected void processAnnotations(AnnotationDesc[] annotationDescs) { 198 for (AnnotationDesc annotationDesc : annotationDescs) { 199 org.fluffnstuff.asdoclet.generator.Type annotation = GeneratorUtils.getAnnotation(annotationDesc.annotationType().qualifiedTypeName(), getGenerator()); 200 if (annotation != null && annotation != org.fluffnstuff.asdoclet.generator.Type.NULL) getGenerator().addAnnotation(annotation); 201 } 202 } 203 204 protected void processAnnotationCommands(Map<String, String> commands) { 205 if (commands.containsKey(Constants.COMMAND_ANNOTATION)) { 206 StringTokenizer tokenizer = new StringTokenizer(commands.get(Constants.COMMAND_ANNOTATION), ","); 207 while (tokenizer.hasMoreTokens()) { 208 getGenerator().addAnnotation(GeneratorUtils.getType(tokenizer.nextToken(), getGenerator())); 209 } 210 } 170 211 } 171 212 trunk/src/org/fluffnstuff/asdoclet/handler/ClassHandler.java
r58 r71 3 3 import java.util.Map; 4 4 import java.util.Set; 5 import java.util.StringTokenizer;6 import java.util.HashSet;7 5 8 6 import org.fluffnstuff.asdoclet.generator.Generator; … … 30 28 getGenerator().beginClass(type); 31 29 32 processAnnotations(commands); 30 processAnnotations(classDoc.annotations()); 31 processAnnotationCommands(commands); 33 32 processSuperClass(classDoc, ignore); 34 33 processInterfaces(classDoc, ignore); trunk/src/org/fluffnstuff/asdoclet/handler/EnumHandler.java
r64 r71 8 8 import org.fluffnstuff.asdoclet.generator.Type; 9 9 import org.fluffnstuff.asdoclet.generator.utils.GeneratorUtils; 10 import org.fluffnstuff.asdoclet.AsDoclet; 11 import org.slf4j.Logger; 12 import org.slf4j.LoggerFactory; 10 13 11 14 import com.sun.javadoc.ClassDoc; … … 13 16 14 17 public class EnumHandler extends AbstractHandler { 18 private final Logger logger = LoggerFactory.getLogger(EnumHandler.class); 19 15 20 public EnumHandler(Generator generator) { 16 21 super(generator); … … 50 55 Method getter = null; 51 56 if (annotation != null) { 52 Class<?> clazz = Class.forName(classDoc.qualifiedName()); 57 try { 58 Class<?> clazz = Class.forName(classDoc.qualifiedName()); 53 59 54 boolean present = false; 55 for (Method method : clazz.getMethods()) { 56 if (method.isAnnotationPresent(annotation)) { 57 if (present) { 58 throw new RuntimeException("enumeration " + classDoc + " has multiple annotations"); 60 boolean present = false; 61 for (Method method : clazz.getMethods()) { 62 if (method.isAnnotationPresent(annotation)) { 63 if (present) { 64 throw new RuntimeException("enumeration " + classDoc + " has multiple annotations"); 65 } 66 67 getter = method; 68 present = true; 59 69 } 60 61 getter = method;62 present = true;63 70 } 71 } catch (ClassNotFoundException e) { 72 logger.error(e.getMessage(), e); 64 73 } 65 74 } trunk/src/org/fluffnstuff/asdoclet/handler/Handler.java
r64 r71 6 6 7 7 public interface Handler { 8 void process(ClassDoc classDoc) throws ClassNotFoundException, InvocationTargetException, IllegalAccessException;8 void process(ClassDoc classDoc) throws ClassNotFoundException, InvocationTargetException, IllegalAccessException; 9 9 } trunk/src/org/fluffnstuff/asdoclet/handler/InterfaceHandler.java
r68 r71 3 3 import java.util.ArrayList; 4 4 import java.util.HashMap; 5 import java.util.Iterator; 5 6 import java.util.Map; 6 7 import java.util.Set; 7 import java.util.Iterator;8 8 9 9 import org.fluffnstuff.asdoclet.generator.Generator; … … 54 54 getGenerator().beginInterface(interfaceName); 55 55 56 processAnnotations(commands); 56 processAnnotations(classDoc.annotations()); 57 processAnnotationCommands(commands); 57 58 processInterfaces(classDoc, ignore); 58 59 processClassComment(classDoc); … … 70 71 processBeanProperty(classDoc, classType, methodDoc, ignore, commands); 71 72 } else { 72 processMethod(class Type, methodDoc, commands, typeMap);73 processMethod(classDoc, classType, methodDoc, ignore, commands, typeMap); 73 74 } 74 75 } 75 76 } 76 77 77 private void processMethod( org.fluffnstuff.asdoclet.generator.Type classType, MethodDoc methodDoc, Map<String, String> commands, Map<String, org.fluffnstuff.asdoclet.generator.Type> typeMap) {78 private void processMethod(ClassDoc classDoc, org.fluffnstuff.asdoclet.generator.Type classType, MethodDoc methodDoc, Set<String> ignore, Map<String, String> commands, Map<String, org.fluffnstuff.asdoclet.generator.Type> typeMap) { 78 79 Map<String, String> methodCommands = new HashMap<String, String>(commands); 80 Map<String, String> methodOnlyCommands = new HashMap<String, String>(); 79 81 org.fluffnstuff.asdoclet.generator.Type returnType = GeneratorUtils.getType(methodDoc.returnType(), getGenerator()); 80 82 org.fluffnstuff.asdoclet.generator.Type methodType = GeneratorUtils.getType(methodDoc, getGenerator()); … … 87 89 org.fluffnstuff.asdoclet.generator.Type actualReturnType = returnType; 88 90 89 TagParser.processTags(methodDoc.tags(getGenerator().getName() + Constants.TAG_METHOD), methodCommands); 91 TagParser.processTags(methodDoc.tags(getGenerator().getName() + Constants.TAG_METHOD), methodOnlyCommands); 92 methodCommands.putAll(methodOnlyCommands); 90 93 91 94 if (!TagParser.getBooleanCommand(Constants.COMMAND_IGNORE, methodCommands)) { … … 113 116 boolean isasync = asyncType != org.fluffnstuff.asdoclet.generator.Type.EMPTY; 114 117 115 getGenerator().beginMethod(classType, methodType, 0, actualReturnType, methodDoc.name(), isasync); 118 String name = methodDoc.name(); 119 boolean override = isOverridden(classDoc, name, ignore); 120 getGenerator().beginMethod(classType, methodType, 0, actualReturnType, name, isasync, override); 121 122 processAnnotations(methodDoc.annotations()); 123 processAnnotationCommands(methodOnlyCommands); 116 124 117 125 if (isasync) {