Changeset 68
- Timestamp:
- 07/16/09 13:50:36 (3 years ago)
- Files:
-
- trunk/out/templates/cs/proxy.vm (modified) (2 diffs)
- trunk/src/org/fluffnstuff/asdoclet/generator/AsGenerator.java (modified) (3 diffs)
- trunk/src/org/fluffnstuff/asdoclet/generator/Generator.java (modified) (1 diff)
- trunk/src/org/fluffnstuff/asdoclet/generator/VelocityGenerator.java (modified) (4 diffs)
- trunk/src/org/fluffnstuff/asdoclet/generator/velocity/MethodDescriptor.java (modified) (2 diffs)
- trunk/src/org/fluffnstuff/asdoclet/handler/InterfaceHandler.java (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/out/templates/cs/proxy.vm
r56 r68 40 40 } 41 41 42 protected void BeginDispatchCall<T>(string methodName, object async, params object[] args) { 43 } 44 42 45 #foreach($methodDescriptor in $typeDescriptor.methodDescriptors) 43 46 #if($methodDescriptor.description) /** … … 46 49 #end 47 50 public virtual $methodDescriptor.modifier #method($methodDescriptor) { 48 #if($methodDescriptor.callbackType.qualifiedTypeName == "void") 49 DispatchCall<object>("${methodDescriptor.methodName}"#foreach($parameterDescriptor in $methodDescriptor.parameterDescriptors), $parameterDescriptor.parameterName#end); 50 #elseif($methodDescriptor.qualifiedTypeName == "void") 51 #if($methodDescriptor.callbackType)#if($methodDescriptor.callbackType.qualifiedTypeName == "void") 52 BeginDispatchCall<object>("${methodDescriptor.methodName}"#foreach($parameterDescriptor in $methodDescriptor.parameterDescriptors), $parameterDescriptor.parameterName#end); 53 #else 54 BeginDispatchCall<#if($methodDescriptor.callbackType)#type($methodDescriptor.callbackType)#{else}object#end>("${methodDescriptor.methodName}"#foreach($parameterDescriptor in $methodDescriptor.parameterDescriptors), $parameterDescriptor.parameterName#end); 55 #end#else#if($methodDescriptor.qualifiedTypeName == "void") 51 56 DispatchCall<#if($methodDescriptor.callbackType)#type($methodDescriptor.callbackType)#{else}object#end>("${methodDescriptor.methodName}"#foreach($parameterDescriptor in $methodDescriptor.parameterDescriptors), $parameterDescriptor.parameterName#end); 52 57 #else 53 58 return DispatchCall<#if($methodDescriptor.callbackType)#type($methodDescriptor.callbackType)#else#type($methodDescriptor)#end>("${methodDescriptor.methodName}"#foreach($parameterDescriptor in $methodDescriptor.parameterDescriptors), $parameterDescriptor.parameterName#end); 54 #end 59 #end#end 55 60 } 56 61 #end trunk/src/org/fluffnstuff/asdoclet/generator/AsGenerator.java
r64 r68 126 126 if (type instanceof ASClassType) { 127 127 addField(classType, Modifier.PRIVATE, fieldType, "_" + propertyName, null, null); 128 beginMethod(classType, Type.EMPTY, modifier, fieldType, "get " + propertyName );128 beginMethod(classType, Type.EMPTY, modifier, fieldType, "get " + propertyName, false); 129 129 method.setOverride(override); 130 130 method.addStmt("return _" + propertyName + ";"); 131 131 } else { 132 beginMethod(classType, Type.EMPTY, modifier, fieldType, "get " + propertyName );132 beginMethod(classType, Type.EMPTY, modifier, fieldType, "get " + propertyName, false); 133 133 } 134 134 … … 161 161 if (type instanceof ASClassType) { 162 162 addField(classType, Modifier.PRIVATE, fieldType, "_" + propertyName, null, null); 163 beginMethod(classType, Type.EMPTY, modifier, Type.VOID, "set " + propertyName );163 beginMethod(classType, Type.EMPTY, modifier, Type.VOID, "set " + propertyName, false); 164 164 method.setOverride(override); 165 165 method.addParam("value", fieldType.getName()); 166 166 method.addStmt("_" + propertyName + "=value;"); 167 167 } else { 168 beginMethod(classType, Type.EMPTY, modifier, Type.VOID, "set " + propertyName );168 beginMethod(classType, Type.EMPTY, modifier, Type.VOID, "set " + propertyName, false); 169 169 method.addParam("value", fieldType.getName()); 170 170 } … … 198 198 } 199 199 200 public void beginMethod(Type classType, Type methodType, int modifier, Type returnType, String methodName ) {200 public void beginMethod(Type classType, Type methodType, int modifier, Type returnType, String methodName, boolean asnyc) { 201 201 returnType = resolveTypeArguments(classType, methodType, returnType); 202 202 trunk/src/org/fluffnstuff/asdoclet/generator/Generator.java
r64 r68 30 30 void beginInterface(Type type); 31 31 32 void beginMethod(Type classType, Type methodType, int modifier, Type returnType, String methodName );32 void beginMethod(Type classType, Type methodType, int modifier, Type returnType, String methodName, boolean async); 33 33 34 34 void beginProxy(Type type, Type baseType, Type interfaceType); trunk/src/org/fluffnstuff/asdoclet/generator/VelocityGenerator.java
r66 r68 14 14 import org.apache.velocity.VelocityContext; 15 15 import org.apache.velocity.app.Velocity; 16 import org.apache.velocity.app.VelocityEngine;17 16 import org.fluffnstuff.asdoclet.generator.utils.GeneratorUtils; 18 17 import org.fluffnstuff.asdoclet.generator.velocity.ClassDescriptor; … … 25 24 import org.fluffnstuff.asdoclet.generator.velocity.ProxyDescriptor; 26 25 import org.fluffnstuff.asdoclet.generator.velocity.TypeDescriptor; 27 import org.fluffnstuff.asdoclet.generator.velocity.SLF4JLogChute;28 26 import org.fluffnstuff.asdoclet.map.TypeMap; 29 27 … … 181 179 } 182 180 183 public void beginMethod(Type classType, Type methodType, int modifier, Type returnType, String methodName ) {184 methodDescriptor = new MethodDescriptor(modifier, returnType, methodType, methodName );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); 185 183 if (typeDescriptor != null) typeDescriptor.addMethodDescriptor(methodDescriptor); 186 184 if (proxyTypeDescriptor != null) proxyTypeDescriptor.addMethodDescriptor(methodDescriptor); … … 270 268 271 269 if (exception && CSHARP.equals(language)) { 272 beginMethod(type, Type.EMPTY, Modifier.PUBLIC, Type.EMPTY, typeDescriptor.getTypeName() );270 beginMethod(type, Type.EMPTY, Modifier.PUBLIC, Type.EMPTY, typeDescriptor.getTypeName(), false); 273 271 addBody(" : base() {}"); 274 272 endMethod(Type.EMPTY); 275 273 276 beginMethod(type, Type.EMPTY, Modifier.PUBLIC, Type.EMPTY, typeDescriptor.getTypeName() );274 beginMethod(type, Type.EMPTY, Modifier.PUBLIC, Type.EMPTY, typeDescriptor.getTypeName(), false); 277 275 addParameter(type, Type.EMPTY, GeneratorUtils.getType(String.class.getCanonicalName(), this), "message"); 278 276 addBody(" : base(message) {}"); 279 277 endMethod(Type.EMPTY); 280 278 281 beginMethod(type, Type.EMPTY, Modifier.PUBLIC, Type.EMPTY, typeDescriptor.getTypeName() );279 beginMethod(type, Type.EMPTY, Modifier.PUBLIC, Type.EMPTY, typeDescriptor.getTypeName(), false); 282 280 addParameter(type, Type.EMPTY, GeneratorUtils.getType(String.class.getCanonicalName(), this), "message"); 283 281 addParameter(type, Type.EMPTY, GeneratorUtils.getType(Exception.class.getCanonicalName(), this), "exception"); trunk/src/org/fluffnstuff/asdoclet/generator/velocity/MethodDescriptor.java
r56 r68 8 8 public class MethodDescriptor extends FieldDescriptor { 9 9 private Collection<ParameterDescriptor> parameterDescriptors = new ArrayList<ParameterDescriptor>(); 10 private boolean async; 10 11 private String body; 11 12 private Type genericType; 12 13 private Type callbackType; 13 14 14 public MethodDescriptor(int modifier, Type type, Type genericType, String methodName ) {15 public MethodDescriptor(int modifier, Type type, Type genericType, String methodName, boolean async) { 15 16 super(modifier, type, methodName, null); 16 17 this.genericType = genericType; 18 this.async = async; 17 19 } 18 20 … … 35 37 public Collection<ParameterDescriptor> getParameterDescriptors() { 36 38 return parameterDescriptors; 39 } 40 41 public boolean isAsync() { 42 return async; 37 43 } 38 44 trunk/src/org/fluffnstuff/asdoclet/handler/InterfaceHandler.java
r62 r68 111 111 } 112 112 113 getGenerator().beginMethod(classType, methodType, 0, actualReturnType, methodDoc.name()); 113 boolean isasync = asyncType != org.fluffnstuff.asdoclet.generator.Type.EMPTY; 114 115 getGenerator().beginMethod(classType, methodType, 0, actualReturnType, methodDoc.name(), isasync); 116 117 if (isasync) { 118 getGenerator().addParameter(classType, methodType, asyncType, Constants.PARAM_ASYNC); 119 } 114 120 115 121 for (Parameter parameter : methodDoc.parameters()) { 116 122 getGenerator().addParameter(classType, methodType, GeneratorUtils.getType(parameter.type(), getGenerator()), parameter.name()); 117 }118 119 if (asyncType != org.fluffnstuff.asdoclet.generator.Type.EMPTY) {120 getGenerator().addParameter(classType, methodType, asyncType, Constants.PARAM_ASYNC);121 123 } 122 124