Changeset 62
- Timestamp:
- 06/17/09 15:44:56 (3 years ago)
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/src/org/fluffnstuff/asdoclet/handler/InterfaceHandler.java
r58 r62 5 5 import java.util.Map; 6 6 import java.util.Set; 7 import java.util.Iterator; 7 8 8 9 import org.fluffnstuff.asdoclet.generator.Generator; … … 56 57 processInterfaces(classDoc, ignore); 57 58 processClassComment(classDoc); 58 processMethods(classDoc, interfaceName, bean, ignore, commands );59 processMethods(classDoc, interfaceName, bean, ignore, commands, null); 59 60 60 61 getGenerator().endInterface(); 61 62 } 62 63 63 private void processMethods(ClassDoc classDoc, org.fluffnstuff.asdoclet.generator.Type classType, boolean bean, Set<String> ignore, Map<String, String> commands ) {64 private void processMethods(ClassDoc classDoc, org.fluffnstuff.asdoclet.generator.Type classType, boolean bean, Set<String> ignore, Map<String, String> commands, Map<String, org.fluffnstuff.asdoclet.generator.Type> typeMap) { 64 65 for (MethodDoc methodDoc : classDoc.methods()) { 65 66 boolean getter = (methodDoc.name().startsWith("get") || methodDoc.name().startsWith("is")) && (methodDoc.parameters().length == 0); … … 69 70 processBeanProperty(classDoc, classType, methodDoc, ignore, commands); 70 71 } else { 71 processMethod(classType, methodDoc, commands );72 processMethod(classType, methodDoc, commands, typeMap); 72 73 } 73 74 } 74 75 } 75 76 76 private void processMethod(org.fluffnstuff.asdoclet.generator.Type classType, MethodDoc methodDoc, Map<String, String> commands ) {77 private void processMethod(org.fluffnstuff.asdoclet.generator.Type classType, MethodDoc methodDoc, Map<String, String> commands, Map<String, org.fluffnstuff.asdoclet.generator.Type> typeMap) { 77 78 Map<String, String> methodCommands = new HashMap<String, String>(commands); 78 79 org.fluffnstuff.asdoclet.generator.Type returnType = GeneratorUtils.getType(methodDoc.returnType(), getGenerator()); 79 80 org.fluffnstuff.asdoclet.generator.Type methodType = GeneratorUtils.getType(methodDoc, getGenerator()); 80 org.fluffnstuff.asdoclet.generator.Type fooType = returnType; 81 82 if (typeMap != null) { 83 if (typeMap.containsKey(returnType.getName())) returnType = typeMap.get(returnType.getName()); 84 if (typeMap.containsKey(methodType.getName())) methodType = typeMap.get(methodType.getName()); 85 } 86 87 org.fluffnstuff.asdoclet.generator.Type actualReturnType = returnType; 81 88 82 89 TagParser.processTags(methodDoc.tags(getGenerator().getName() + Constants.TAG_METHOD), methodCommands); … … 101 108 } 102 109 103 fooType = methodReturnType != null ? GeneratorUtils.getType(methodReturnType, getGenerator()) : org.fluffnstuff.asdoclet.generator.Type.VOID;110 actualReturnType = methodReturnType != null ? GeneratorUtils.getType(methodReturnType, getGenerator()) : org.fluffnstuff.asdoclet.generator.Type.VOID; 104 111 } 105 112 106 getGenerator().beginMethod(classType, methodType, 0, fooType, methodDoc.name());113 getGenerator().beginMethod(classType, methodType, 0, actualReturnType, methodDoc.name()); 107 114 108 115 for (Parameter parameter : methodDoc.parameters()) { … … 133 140 for (Type type : interfaceDoc.interfaceTypes()) { 134 141 ClassDoc classDoc = type.asClassDoc(); 135 org.fluffnstuff.asdoclet.generator.Type interfaceClass = GeneratorUtils.getType(type, getGenerator());136 142 137 if (interfaceClass != org.fluffnstuff.asdoclet.generator.Type.NULL && !ignore.contains(interfaceClass.getName())) { 143 org.fluffnstuff.asdoclet.generator.Type interfaceType = GeneratorUtils.getType(type, getGenerator()); 144 145 if (interfaceType != org.fluffnstuff.asdoclet.generator.Type.NULL && !ignore.contains(interfaceType.getName())) { 146 org.fluffnstuff.asdoclet.generator.Type interfaceClass = GeneratorUtils.getType(classDoc, getGenerator()); 147 Map<String, org.fluffnstuff.asdoclet.generator.Type> typeMap = null; 148 149 if (interfaceClass.getArguments() != null && interfaceType.getArguments() != null) { 150 typeMap = new HashMap<String, org.fluffnstuff.asdoclet.generator.Type>(); 151 152 Iterator<org.fluffnstuff.asdoclet.generator.Type> classIterator = interfaceClass.getArguments().iterator(); 153 Iterator<org.fluffnstuff.asdoclet.generator.Type> typeIterator = interfaceType.getArguments().iterator(); 154 while (classIterator.hasNext() && typeIterator.hasNext()) { 155 typeMap.put(classIterator.next().getName(), typeIterator.next()); 156 } 157 } 158 138 159 Map<String, String> commands = new HashMap<String, String>(parentCommands); 139 160 commands.putAll(TagParser.processClassTags(getGenerator(), classDoc)); 140 161 141 162 boolean bean = TagParser.getBooleanCommand(Constants.COMMAND_BEAN, commands); 142 processMethods(classDoc, interface Class, bean, ignore, commands);163 processMethods(classDoc, interfaceType, bean, ignore, commands, typeMap); 143 164 144 165 traverseInterfaces(classDoc, ignore, commands);