diff --git a/.classpath b/.classpath
index f261b4939..ec034f681 100644
--- a/.classpath
+++ b/.classpath
@@ -9,7 +9,6 @@
-
diff --git a/build.xml b/build.xml
index c06685a09..5e3d0c8d4 100644
--- a/build.xml
+++ b/build.xml
@@ -228,17 +228,12 @@
-
-
-
-
-
-
-
-
-
+
+
+
+
diff --git a/etc/libs-incl.xml b/etc/libs-incl.xml
index 28233f35d..9dded813e 100644
--- a/etc/libs-incl.xml
+++ b/etc/libs-incl.xml
@@ -5,8 +5,6 @@
-
-
@@ -16,12 +14,12 @@
+
-
diff --git a/src/java/com/threerings/crowd/data/LocationMarshaller.java b/src/java/com/threerings/crowd/data/LocationMarshaller.java
index d21a7c03f..d6f55a1d7 100644
--- a/src/java/com/threerings/crowd/data/LocationMarshaller.java
+++ b/src/java/com/threerings/crowd/data/LocationMarshaller.java
@@ -81,7 +81,8 @@ public class LocationMarshaller extends InvocationMarshaller
// from interface LocationService
public void leavePlace (Client arg1)
{
- sendRequest(arg1, LEAVE_PLACE, new Object[] {});
+ sendRequest(arg1, LEAVE_PLACE, new Object[] {
+ });
}
/** The method id used to dispatch {@link #moveTo} requests. */
diff --git a/src/java/com/threerings/presents/tools/GenDObjectTask.java b/src/java/com/threerings/presents/tools/GenDObjectTask.java
index b630cdd1c..935d9fa3b 100644
--- a/src/java/com/threerings/presents/tools/GenDObjectTask.java
+++ b/src/java/com/threerings/presents/tools/GenDObjectTask.java
@@ -123,6 +123,7 @@ public class GenDObjectTask extends GenTask
// if this field is an array, we need its component types
if (ftype.isArray()) {
Class> etype = ftype.getComponentType();
+ data.put("have_elem", true);
data.put("elemtype", GenUtil.simpleName(etype));
data.put("wrapelem", GenUtil.boxArgument(etype, "value"));
data.put("wrapoelem", GenUtil.boxArgument(etype, "ovalue"));
diff --git a/src/java/com/threerings/presents/tools/GenServiceTask.java b/src/java/com/threerings/presents/tools/GenServiceTask.java
index 564fe51be..bf6882d4c 100644
--- a/src/java/com/threerings/presents/tools/GenServiceTask.java
+++ b/src/java/com/threerings/presents/tools/GenServiceTask.java
@@ -24,7 +24,9 @@ package com.threerings.presents.tools;
import java.lang.reflect.Method;
import java.lang.reflect.Modifier;
+import java.util.Collections;
import java.util.HashMap;
+import java.util.List;
import java.util.Map;
import java.util.Set;
@@ -32,9 +34,9 @@ import java.io.File;
import com.google.common.base.Predicate;
import com.google.common.collect.Iterables;
+import com.google.common.collect.Lists;
import com.google.common.collect.Sets;
-import com.samskivert.util.ComparableArrayList;
import com.samskivert.util.StringUtil;
import com.threerings.util.ActionScript;
@@ -64,8 +66,7 @@ public class GenServiceTask extends InvocationTask
{
public Class> listener;
- public ComparableArrayList methods =
- new ComparableArrayList();
+ public List methods = Lists.newArrayList();
/** Contains all imports required for the parameters of the methods in this listener. */
public ImportSet imports = new ImportSet();
@@ -99,7 +100,7 @@ public class GenServiceTask extends InvocationTask
}
}
}
- methods.sort();
+ Collections.sort(methods);
}
protected void addInterfaces (Class> listener, Set> ifaces)
@@ -125,7 +126,7 @@ public class GenServiceTask extends InvocationTask
});
}
- public String getName ()
+ public String getListenerName ()
{
String name = GenUtil.simpleName(listener);
name = name.replace("Listener", "");
@@ -133,10 +134,18 @@ public class GenServiceTask extends InvocationTask
return name.substring(didx+1);
}
+ public String adapterCtorArgs () {
+ StringBuilder sb = new StringBuilder();
+ for (ServiceMethod m : methods) {
+ sb.append(m.method.getName() + " :Function, ");
+ }
+ return sb.toString();
+ }
+
// from interface Comparable
public int compareTo (ServiceListener other)
{
- return getName().compareTo(other.getName());
+ return getListenerName().compareTo(other.getListenerName());
}
@Override
@@ -377,7 +386,7 @@ public class GenServiceTask extends InvocationTask
ctx.put("imports", imports.toList());
ctx.put("listener", listener);
String aslpath = _asroot + File.separator + mppath +
- File.separator + mname + "_" + listener.getName() + "Marshaller.as";
+ File.separator + mname + "_" + listener.getListenerName() + "Marshaller.as";
writeFile(aslpath, mergeTemplate(AS_LISTENER_MARSHALLER_TMPL, ctx));
}
@@ -460,13 +469,13 @@ public class GenServiceTask extends InvocationTask
ctx.put("imports", imports.toList());
ctx.put("listener", listener);
- String aslpath = _asroot + File.separator + sppath +
- File.separator + sname + "_" + listener.getName() + "Listener.as";
+ String aslpath = _asroot + File.separator + sppath + File.separator +
+ sname + "_" + listener.getListenerName() + "Listener.as";
writeFile(aslpath, mergeTemplate(AS_LISTENER_SERVICE_TMPL, ctx));
if (_aslistenerAdapters.contains(sname)) {
- String aslapath = _asroot + File.separator + sppath +
- File.separator + sname + "_" + listener.getName() + "ListenerAdapter.as";
+ String aslapath = _asroot + File.separator + sppath + File.separator +
+ sname + "_" + listener.getListenerName() + "ListenerAdapter.as";
writeFile(aslapath, mergeTemplate(AS_LISTENER_ADAPTER_SERVICE_TMPL, ctx));
}
}
@@ -600,10 +609,8 @@ public class GenServiceTask extends InvocationTask
public String sname;
public String spackage;
public ImportSet imports = new ImportSet();
- public ComparableArrayList methods =
- new ComparableArrayList();
- public ComparableArrayList listeners =
- new ComparableArrayList();
+ public List methods = Lists.newArrayList();
+ public List listeners = Lists.newArrayList();
public final boolean skipAS;
public ServiceDescription (Class> serviceClass)
@@ -641,8 +648,8 @@ public class GenServiceTask extends InvocationTask
StringUtil.toString(imports));
}
}
- listeners.sort();
- methods.sort();
+ Collections.sort(listeners);
+ Collections.sort(methods);
}
/**
diff --git a/src/java/com/threerings/presents/tools/GenTask.java b/src/java/com/threerings/presents/tools/GenTask.java
index e9d61d1e0..572f82115 100644
--- a/src/java/com/threerings/presents/tools/GenTask.java
+++ b/src/java/com/threerings/presents/tools/GenTask.java
@@ -25,6 +25,7 @@ import java.util.List;
import java.util.Map;
import java.io.File;
+import java.io.InputStreamReader;
import java.io.StringWriter;
import org.apache.tools.ant.AntClassLoader;
@@ -34,24 +35,14 @@ import org.apache.tools.ant.Task;
import org.apache.tools.ant.types.FileSet;
import org.apache.tools.ant.types.Reference;
import org.apache.tools.ant.util.ClasspathUtils;
-import org.apache.velocity.VelocityContext;
-import org.apache.velocity.app.VelocityEngine;
+import com.google.common.collect.Maps;
import com.google.common.collect.Lists;
-import com.samskivert.velocity.VelocityUtil;
+import com.samskivert.mustache.Mustache;
public abstract class GenTask extends Task
{
- public GenTask ()
- {
- try {
- _velocity = VelocityUtil.createEngine();
- } catch (Exception e) {
- throw new BuildException("Failure initializing Velocity", e);
- }
- }
-
/**
* Adds a nested <fileset> element which enumerates service declaration source files.
*/
@@ -109,7 +100,7 @@ public abstract class GenTask extends Task
protected String mergeTemplate (String template, Object... data)
throws Exception
{
- VelocityContext ctx = new VelocityContext();
+ Map ctx = Maps.newHashMap();
for (int ii = 0; ii < data.length; ii += 2) {
ctx.put((String)data[ii], data[ii+1]);
}
@@ -124,23 +115,8 @@ public abstract class GenTask extends Task
protected String mergeTemplate (String template, Map data)
throws Exception
{
- VelocityContext ctx = new VelocityContext();
- for (Map.Entry entry : data.entrySet()) {
- ctx.put(entry.getKey(), entry.getValue());
- }
- return mergeTemplate(template, ctx);
- }
-
- /**
- * A helper function for {@link #mergeTemplate(String, Map)} and friends. Don't
- * use this directly as you'll end up depending on Velocity and your code won't build.
- */
- protected String mergeTemplate (String template, VelocityContext ctx)
- throws Exception
- {
- StringWriter writer = new StringWriter();
- _velocity.mergeTemplate(template, "UTF-8", ctx, writer);
- return writer.toString();
+ return Mustache.compiler().escapeHTML(false).compile(new InputStreamReader(
+ getClass().getClassLoader().getResourceAsStream(template), "UTF-8")).execute(data);
}
/**
@@ -185,8 +161,4 @@ public abstract class GenTask extends Task
/** Used to do our own classpath business. */
protected ClassLoader _cloader;
-
- /** Used to generate source files from templates. Don't use this directly from derived classes,
- * use {@link #mergeTemplate}. */
- protected VelocityEngine _velocity;
}
diff --git a/src/java/com/threerings/presents/tools/InvocationTask.java b/src/java/com/threerings/presents/tools/InvocationTask.java
index 314796d3f..2a36e0ff5 100644
--- a/src/java/com/threerings/presents/tools/InvocationTask.java
+++ b/src/java/com/threerings/presents/tools/InvocationTask.java
@@ -56,18 +56,14 @@ public abstract class InvocationTask extends GenTask
/** Used to keep track of invocation service method listener arguments. */
public class ListenerArgument
{
- public int index;
-
public Class> listener;
- public ListenerArgument (int index, Class> listener)
- {
- this.index = index+1;
+ public ListenerArgument (int index, Class> listener) {
this.listener = listener;
+ _index = index;
}
- public String getMarshaller ()
- {
+ public String getMarshaller () {
String name = GenUtil.simpleName(listener);
// handle ye olde special case
if (name.equals("InvocationService.InvocationListener")) {
@@ -77,8 +73,7 @@ public abstract class InvocationTask extends GenTask
return name.replace("Listener", "Marshaller");
}
- public String getActionScriptMarshaller ()
- {
+ public String getActionScriptMarshaller () {
// handle ye olde special case
String name = listener.getName();
if (name.endsWith("InvocationService$InvocationListener")) {
@@ -87,13 +82,22 @@ public abstract class InvocationTask extends GenTask
return getMarshaller().replace('.', '_');
}
}
+
+ public int getIndex () {
+ return _index+1;
+ }
+
+ public int getIndexSkipFirst () {
+ return _index;
+ }
+
+ protected int _index;
}
/** Used to keep track of invocation service methods or listener methods. */
public class ServiceMethod implements Comparable
{
public Method method;
-
public List listenerArgs = Lists.newArrayList();
/**
@@ -101,8 +105,7 @@ public abstract class InvocationTask extends GenTask
* @param method the method to inspect
* @param imports will be filled with the types required by the method
*/
- public ServiceMethod (Method method, ImportSet imports)
- {
+ public ServiceMethod (Method method, ImportSet imports) {
this.method = method;
// if this method has listener arguments, we need to add listener argument info for them
@@ -130,8 +133,220 @@ public abstract class InvocationTask extends GenTask
}
}
- protected void addImportsForType (Type type, ImportSet imports)
- {
+ public String getCode () {
+ return StringUtil.unStudlyName(method.getName()).toUpperCase();
+ }
+
+ public String getSenderMethodName () {
+ String mname = method.getName();
+ if (mname.startsWith("received")) {
+ return "send" + mname.substring("received".length());
+ } else {
+ return mname;
+ }
+ }
+
+ public String getArgListSkipFirst () {
+ return getArgList(true);
+ }
+
+ public String getArgList () {
+ return getArgList(false);
+ }
+
+ public String getArgList (boolean skipFirst) {
+ StringBuilder buf = new StringBuilder();
+ Type[] ptypes = method.getGenericParameterTypes();
+ for (int ii = skipFirst ? 1 : 0; ii < ptypes.length; ii++) {
+ if (buf.length() > 0) {
+ buf.append(", ");
+ }
+ String simpleName = GenUtil.simpleName(ptypes[ii]);
+ if (method.isVarArgs() && ii == ptypes.length - 1) {
+ // Switch [] with ... for varargs
+ buf.append(simpleName.substring(0, simpleName.length() - 2)).append("...");
+ } else {
+ buf.append(simpleName);
+ }
+ buf.append(" arg").append(skipFirst ? ii : ii+1);
+ }
+ return buf.toString();
+ }
+
+ public String getASArgListSkipFirst () {
+ return getASArgList(true);
+ }
+
+ public String getASArgList () {
+ return getASArgList(false);
+ }
+
+ public String getASArgList (boolean skipFirst) {
+ StringBuilder buf = new StringBuilder();
+ Class>[] args = method.getParameterTypes();
+ for (int ii = skipFirst ? 1 : 0; ii < args.length; ii++) {
+ if (buf.length() > 0) {
+ buf.append(", ");
+ }
+ buf.append("arg").append(skipFirst ? ii : ii+1).append(" :");
+ buf.append(GenUtil.simpleASName(args[ii]));
+ }
+ return buf.toString();
+ }
+
+ public String getASInvokArgList () {
+ StringBuilder buf = new StringBuilder();
+ Class>[] args = method.getParameterTypes();
+ for (int ii = 0; ii < args.length; ii++) {
+ if (buf.length() > 0) {
+ buf.append(", ");
+ }
+ buf.append("arg").append(ii);
+ }
+ return buf.toString();
+ }
+
+ public String getWrappedArgListSkipFirst () {
+ return getWrappedArgList(true);
+ }
+
+ public String getWrappedArgList () {
+ return getWrappedArgList(false);
+ }
+
+ public String getWrappedArgList (boolean skipFirst) {
+ StringBuilder buf = new StringBuilder();
+ Class>[] args = method.getParameterTypes();
+ for (int ii = (skipFirst ? 1 : 0); ii < args.length; ii++) {
+ if (buf.length() > 0) {
+ buf.append(", ");
+ }
+ buf.append(boxArgument(args[ii], ii+1));
+ }
+ return buf.toString();
+ }
+
+ public String getASWrappedArgListSkipFirst () {
+ return getASWrappedArgList(true);
+ }
+
+ public String getASWrappedArgList () {
+ return getASWrappedArgList(false);
+ }
+
+ public String getASWrappedArgList (boolean skipFirst) {
+ StringBuilder buf = new StringBuilder();
+ Class>[] args = method.getParameterTypes();
+ for (int ii = (skipFirst ? 1 : 0); ii < args.length; ii++) {
+ if (buf.length() > 0) {
+ buf.append(", ");
+ }
+ String index = String.valueOf(skipFirst ? ii : (ii+1));
+ String arg;
+ if (_ilistener.isAssignableFrom(args[ii])) {
+ arg = GenUtil.boxASArgument(args[ii], "listener" + index);
+ } else {
+ arg = GenUtil.boxASArgument(args[ii], "arg" + index);
+ }
+ buf.append(arg);
+ }
+ return buf.toString();
+ }
+
+ public boolean hasArgsSkipFirst () {
+ return (method.getParameterTypes().length > 1);
+ }
+
+ public boolean hasArgs () {
+ return (method.getParameterTypes().length > 0);
+ }
+
+ public boolean hasParameterizedArgs () {
+ return Iterables.any(
+ Arrays.asList(method.getGenericParameterTypes()), new Predicate() {
+ public boolean apply (Type type) {
+ // TODO: might eventually need to handle generic arrays and wildcard types
+ return (type instanceof ParameterizedType);
+ }
+ });
+ }
+
+ public String getUnwrappedArgListAsListeners () {
+ return getUnwrappedArgList(true);
+ }
+
+ public String getUnwrappedArgList () {
+ return getUnwrappedArgList(false);
+ }
+
+ public String getUnwrappedArgList (boolean listenerMode) {
+ StringBuilder buf = new StringBuilder();
+ Type[] ptypes = method.getGenericParameterTypes();
+ for (int ii = (listenerMode ? 0 : 1); ii < ptypes.length; ii++) {
+ if (buf.length() > 0) {
+ buf.append(", ");
+ }
+ buf.append(unboxArgument(ptypes[ii], listenerMode ? ii : ii-1, listenerMode));
+ }
+ return buf.toString();
+ }
+
+ public String getASUnwrappedArgListAsListeners () {
+ return getASUnwrappedArgList(true);
+ }
+
+ public String getASUnwrappedArgList () {
+ return getASUnwrappedArgList(false);
+ }
+
+ public String getASUnwrappedArgList (boolean listenerMode) {
+ StringBuilder buf = new StringBuilder();
+ Class>[] args = method.getParameterTypes();
+ for (int ii = (listenerMode ? 0 : 1); ii < args.length; ii++) {
+ if (buf.length() > 0) {
+ buf.append(", ");
+ }
+ String arg;
+ int argidx = listenerMode ? ii : ii-1;
+ if (listenerMode && _ilistener.isAssignableFrom(args[ii])) {
+ arg = "listener" + argidx;
+ } else {
+ arg = GenUtil.unboxASArgument(args[ii], "args[" + argidx + "]");
+ }
+ buf.append(arg);
+ }
+ return buf.toString();
+ }
+
+ public String getTransport () {
+ TransportHint hint = method.getAnnotation(TransportHint.class);
+ if (hint == null) {
+ // inherit hint from interface annotation
+ hint = method.getDeclaringClass().getAnnotation(TransportHint.class);
+ }
+ if (hint == null) {
+ return "";
+ }
+ return ", Transport.getInstance(Transport.Type." +
+ hint.type().name() + ", " + hint.channel() + ")";
+ }
+
+ // from interface Comparator
+ public int compareTo (ServiceMethod other) {
+ return getCode().compareTo(other.getCode());
+ }
+
+ @Override // from Object
+ public boolean equals (Object other) {
+ return (other instanceof ServiceMethod) && compareTo((ServiceMethod)other) == 0;
+ }
+
+ @Override // from Object
+ public int hashCode () {
+ return getCode().hashCode();
+ }
+
+ protected void addImportsForType (Type type, ImportSet imports) {
if (type instanceof Class>) {
imports.add((Class>)type);
} else if (type instanceof ParameterizedType) {
@@ -155,171 +370,7 @@ public abstract class InvocationTask extends GenTask
}
}
- public String getCode ()
- {
- return StringUtil.unStudlyName(method.getName()).toUpperCase();
- }
-
- public String getSenderMethodName ()
- {
- String mname = method.getName();
- if (mname.startsWith("received")) {
- return "send" + mname.substring("received".length());
- } else {
- return mname;
- }
- }
-
- public String getArgList (boolean skipFirst)
- {
- StringBuilder buf = new StringBuilder();
- Type[] ptypes = method.getGenericParameterTypes();
- for (int ii = skipFirst ? 1 : 0; ii < ptypes.length; ii++) {
- if (buf.length() > 0) {
- buf.append(", ");
- }
- String simpleName = GenUtil.simpleName(ptypes[ii]);
- if (method.isVarArgs() && ii == ptypes.length - 1) {
- // Switch [] with ... for varargs
- buf.append(simpleName.substring(0, simpleName.length() - 2)).append("...");
- } else {
- buf.append(simpleName);
- }
- buf.append(" arg").append(skipFirst ? ii : ii+1);
- }
- return buf.toString();
- }
-
- public String getASArgList (boolean skipFirst)
- {
- StringBuilder buf = new StringBuilder();
- Class>[] args = method.getParameterTypes();
- for (int ii = skipFirst ? 1 : 0; ii < args.length; ii++) {
- if (buf.length() > 0) {
- buf.append(", ");
- }
- buf.append("arg").append(skipFirst ? ii : ii+1).append(" :");
- buf.append(GenUtil.simpleASName(args[ii]));
- }
- return buf.toString();
- }
-
- public String getWrappedArgList (boolean skipFirst)
- {
- StringBuilder buf = new StringBuilder();
- Class>[] args = method.getParameterTypes();
- for (int ii = (skipFirst ? 1 : 0); ii < args.length; ii++) {
- if (buf.length() > 0) {
- buf.append(", ");
- }
- buf.append(boxArgument(args[ii], ii+1));
- }
- return buf.toString();
- }
-
- public String getASWrappedArgList (boolean skipFirst)
- {
- StringBuilder buf = new StringBuilder();
- Class>[] args = method.getParameterTypes();
- for (int ii = (skipFirst ? 1 : 0); ii < args.length; ii++) {
- if (buf.length() > 0) {
- buf.append(", ");
- }
- String index = String.valueOf(skipFirst ? ii : (ii+1));
- String arg;
- if (_ilistener.isAssignableFrom(args[ii])) {
- arg = GenUtil.boxASArgument(args[ii], "listener" + index);
- } else {
- arg = GenUtil.boxASArgument(args[ii], "arg" + index);
- }
- buf.append(arg);
- }
- return buf.toString();
- }
-
- public boolean hasArgs (boolean skipFirst)
- {
- return (method.getParameterTypes().length > (skipFirst ? 1 : 0));
- }
-
- public boolean hasParameterizedArgs ()
- {
- return Iterables.any(
- Arrays.asList(method.getGenericParameterTypes()), new Predicate() {
- public boolean apply (Type type) {
- // TODO: might eventually need to handle generic arrays and wildcard types
- return (type instanceof ParameterizedType);
- }
- });
- }
-
- public String getUnwrappedArgList (boolean listenerMode)
- {
- StringBuilder buf = new StringBuilder();
- Type[] ptypes = method.getGenericParameterTypes();
- for (int ii = (listenerMode ? 0 : 1); ii < ptypes.length; ii++) {
- if (buf.length() > 0) {
- buf.append(", ");
- }
- buf.append(unboxArgument(ptypes[ii], listenerMode ? ii : ii-1, listenerMode));
- }
- return buf.toString();
- }
-
- public String getASUnwrappedArgList (boolean listenerMode)
- {
- StringBuilder buf = new StringBuilder();
- Class>[] args = method.getParameterTypes();
- for (int ii = (listenerMode ? 0 : 1); ii < args.length; ii++) {
- if (buf.length() > 0) {
- buf.append(", ");
- }
- String arg;
- int argidx = listenerMode ? ii : ii-1;
- if (listenerMode && _ilistener.isAssignableFrom(args[ii])) {
- arg = "listener" + argidx;
- } else {
- arg = GenUtil.unboxASArgument(args[ii], "args[" + argidx + "]");
- }
- buf.append(arg);
- }
- return buf.toString();
- }
-
- public String getTransport ()
- {
- TransportHint hint = method.getAnnotation(TransportHint.class);
- if (hint == null) {
- // inherit hint from interface annotation
- hint = method.getDeclaringClass().getAnnotation(TransportHint.class);
- }
- if (hint == null) {
- return "";
- }
- return ", Transport.getInstance(Transport.Type." +
- hint.type().name() + ", " + hint.channel() + ")";
- }
-
- // from interface Comparator
- public int compareTo (ServiceMethod other)
- {
- return getCode().compareTo(other.getCode());
- }
-
- @Override // from Object
- public boolean equals (Object other)
- {
- return (other instanceof ServiceMethod) && compareTo((ServiceMethod)other) == 0;
- }
-
- @Override // from Object
- public int hashCode ()
- {
- return getCode().hashCode();
- }
-
- protected String boxArgument (Class> clazz, int index)
- {
+ protected String boxArgument (Class> clazz, int index) {
if (_ilistener.isAssignableFrom(clazz)) {
return GenUtil.boxArgument(clazz, "listener" + index);
} else {
@@ -327,8 +378,7 @@ public abstract class InvocationTask extends GenTask
}
}
- protected String unboxArgument (Type type, int index, boolean listenerMode)
- {
+ protected String unboxArgument (Type type, int index, boolean listenerMode) {
if (listenerMode && (type instanceof Class>) &&
_ilistener.isAssignableFrom((Class>)type)) {
return "listener" + index;
diff --git a/src/java/com/threerings/presents/tools/decoder.tmpl b/src/java/com/threerings/presents/tools/decoder.tmpl
index 4a73dadae..54c99f008 100644
--- a/src/java/com/threerings/presents/tools/decoder.tmpl
+++ b/src/java/com/threerings/presents/tools/decoder.tmpl
@@ -1,28 +1,28 @@
-package $package;
+package {{package}};
-#foreach ($import in $imports)
-import $import;
-#end
+{{#imports}}
+import {{this}};
+{{/imports}}
/**
- * Dispatches calls to a {@link ${name}Receiver} instance.
+ * Dispatches calls to a {@link {{name}}Receiver} instance.
*/
-public class ${name}Decoder extends InvocationDecoder
+public class {{name}}Decoder extends InvocationDecoder
{
/** The generated hash code used to identify this receiver class. */
- public static final String RECEIVER_CODE = "$receiver_code";
+ public static final String RECEIVER_CODE = "{{receiver_code}}";
-#foreach ($m in $methods)
- /** The method id used to dispatch {@link ${name}Receiver#$m.method.name}
+{{#methods}}
+ /** The method id used to dispatch {@link {{name}}Receiver#{{method.name}}}
* notifications. */
- public static final int $m.code = $velocityCount;
+ public static final int {{code}} = {{-index}};
-#end
+{{/methods}}
/**
* Creates a decoder that may be registered to dispatch invocation
* service notifications to the specified receiver.
*/
- public ${name}Decoder (${name}Receiver receiver)
+ public {{name}}Decoder ({{name}}Receiver receiver)
{
this.receiver = receiver;
}
@@ -37,14 +37,14 @@ public class ${name}Decoder extends InvocationDecoder
public void dispatchNotification (int methodId, Object[] args)
{
switch (methodId) {
-#foreach ($m in $methods)
- case $m.code:
- ((${name}Receiver)receiver).${m.method.name}(
- $m.getUnwrappedArgList(true)
+{{#methods}}
+ case {{code}}:
+ (({{name}}Receiver)receiver).{{method.name}}(
+ {{getUnwrappedArgListAsListeners}}
);
return;
-#end
+{{/methods}}
default:
super.dispatchNotification(methodId, args);
return;
diff --git a/src/java/com/threerings/presents/tools/dispatcher.tmpl b/src/java/com/threerings/presents/tools/dispatcher.tmpl
index 5488352da..2ffc69d95 100644
--- a/src/java/com/threerings/presents/tools/dispatcher.tmpl
+++ b/src/java/com/threerings/presents/tools/dispatcher.tmpl
@@ -1,30 +1,30 @@
-package $package;
+package {{package}};
import javax.annotation.Generated;
-#foreach ($import in $imports)
-import $import;
-#end
+{{#imports}}
+import {{this}};
+{{/imports}}
/**
- * Dispatches requests to the {@link ${name}Provider}.
+ * Dispatches requests to the {@link {{name}}Provider}.
*/
-${generated}
-public class ${name}Dispatcher extends InvocationDispatcher<${name}Marshaller>
+{{generated}}
+public class {{name}}Dispatcher extends InvocationDispatcher<{{name}}Marshaller>
{
/**
* Creates a dispatcher that may be registered to dispatch invocation
* service requests for the specified provider.
*/
- public ${name}Dispatcher (${name}Provider provider)
+ public {{name}}Dispatcher ({{name}}Provider provider)
{
this.provider = provider;
}
@Override
- public ${name}Marshaller createMarshaller ()
+ public {{name}}Marshaller createMarshaller ()
{
- return new ${name}Marshaller();
+ return new {{name}}Marshaller();
}
@Override
@@ -33,14 +33,14 @@ public class ${name}Dispatcher extends InvocationDispatcher<${name}Marshaller>
throws InvocationException
{
switch (methodId) {
-#foreach ($m in $methods)
- case ${name}Marshaller.$m.code:
- ((${name}Provider)provider).${m.method.name}(
- source#if ($m.hasArgs(true)), #end$m.getUnwrappedArgList(false)
+{{#methods}}
+ case {{name}}Marshaller.{{code}}:
+ (({{name}}Provider)provider).{{method.name}}(
+ source{{#hasArgsSkipFirst}}, {{/hasArgsSkipFirst}}{{getUnwrappedArgList}}
);
return;
-#end
+{{/methods}}
default:
super.dispatchRequest(source, methodId, args);
return;
diff --git a/src/java/com/threerings/presents/tools/dobject_field.tmpl b/src/java/com/threerings/presents/tools/dobject_field.tmpl
index 22165d287..59041230d 100644
--- a/src/java/com/threerings/presents/tools/dobject_field.tmpl
+++ b/src/java/com/threerings/presents/tools/dobject_field.tmpl
@@ -1,36 +1,34 @@
/**
- * Requests that the $field field be set to the
+ * Requests that the {{field}} field be set to the
* specified value. The local value will be updated immediately and an
* event will be propagated through the system to notify all listeners
* that the attribute did change. Proxied copies of this object (on
* clients) will apply the value change when they received the
* attribute changed notification.
*/
- ${generated}
- public void set$upfield ($type value)
+ {{generated}}
+ public void set{{upfield}} ({{type}} value)
{
- $type ovalue = this.$field;
+ {{type}} ovalue = this.{{field}};
requestAttributeChange(
- $capfield, $wrapfield, $wrapofield$transport);
- this.$field = $clonefield;
- }
-#if ($elemtype)
+ {{capfield}}, {{wrapfield}}, {{wrapofield}}{{transport}});
+ this.{{field}} = {{clonefield}};
+ }{{#have_elem}}
/**
* Requests that the indexth element of
- * $field field be set to the specified value.
+ * {{field}} field be set to the specified value.
* The local value will be updated immediately and an event will be
* propagated through the system to notify all listeners that the
* attribute did change. Proxied copies of this object (on clients)
* will apply the value change when they received the attribute
* changed notification.
*/
- ${generated}
- public void set${upfield}At ($elemtype value, int index)
+ {{generated}}
+ public void set{{upfield}}At ({{elemtype}} value, int index)
{
- $elemtype ovalue = this.$field[index];
+ {{elemtype}} ovalue = this.{{field}}[index];
requestElementUpdate(
- $capfield, index, $wrapelem, $wrapoelem$transport);
- this.$field[index] = value;
- }
-#end
+ {{capfield}}, index, {{wrapelem}}, {{wrapoelem}}{{transport}});
+ this.{{field}}[index] = value;
+ }{{/have_elem}}
diff --git a/src/java/com/threerings/presents/tools/dobject_name.tmpl b/src/java/com/threerings/presents/tools/dobject_name.tmpl
index 5e1ed1508..9eba677c0 100644
--- a/src/java/com/threerings/presents/tools/dobject_name.tmpl
+++ b/src/java/com/threerings/presents/tools/dobject_name.tmpl
@@ -1,3 +1,3 @@
- /** The field name of the $field field. */
- ${generated}
- public static final String $capfield = "$field";
+ /** The field name of the {{field}} field. */
+ {{generated}}
+ public static final String {{capfield}} = "{{field}}";
diff --git a/src/java/com/threerings/presents/tools/dobject_oidlist.tmpl b/src/java/com/threerings/presents/tools/dobject_oidlist.tmpl
index 2ba667dd8..3d80486ac 100644
--- a/src/java/com/threerings/presents/tools/dobject_oidlist.tmpl
+++ b/src/java/com/threerings/presents/tools/dobject_oidlist.tmpl
@@ -1,21 +1,21 @@
/**
- * Requests that oid be added to the $field
+ * Requests that oid be added to the {{field}}
* oid list. The list will not change until the event is actually
* propagated through the system.
*/
- ${generated}
- public void addTo$upfield (int oid)
+ {{generated}}
+ public void addTo{{upfield}} (int oid)
{
- requestOidAdd($capfield, oid);
+ requestOidAdd({{capfield}}, oid);
}
/**
* Requests that oid be removed from the
- * $field oid list. The list will not change until the
+ * {{field}} oid list. The list will not change until the
* event is actually propagated through the system.
*/
- ${generated}
- public void removeFrom$upfield (int oid)
+ {{generated}}
+ public void removeFrom{{upfield}} (int oid)
{
- requestOidRemove($capfield, oid);
+ requestOidRemove({{capfield}}, oid);
}
diff --git a/src/java/com/threerings/presents/tools/dobject_set.tmpl b/src/java/com/threerings/presents/tools/dobject_set.tmpl
index 805ab539f..84441b2f2 100644
--- a/src/java/com/threerings/presents/tools/dobject_set.tmpl
+++ b/src/java/com/threerings/presents/tools/dobject_set.tmpl
@@ -1,38 +1,38 @@
/**
* Requests that the specified entry be added to the
- * $field set. The set will not change until the event is
+ * {{field}} set. The set will not change until the event is
* actually propagated through the system.
*/
- ${generated}
- public void addTo$upfield ($etype elem)
+ {{generated}}
+ public void addTo{{upfield}} ({{etype}} elem)
{
- requestEntryAdd($capfield, $field, elem);
+ requestEntryAdd({{capfield}}, {{field}}, elem);
}
/**
* Requests that the entry matching the supplied key be removed from
- * the $field set. The set will not change until the
+ * the {{field}} set. The set will not change until the
* event is actually propagated through the system.
*/
- ${generated}
- public void removeFrom$upfield (Comparable> key)
+ {{generated}}
+ public void removeFrom{{upfield}} (Comparable> key)
{
- requestEntryRemove($capfield, $field, key);
+ requestEntryRemove({{capfield}}, {{field}}, key);
}
/**
* Requests that the specified entry be updated in the
- * $field set. The set will not change until the event is
+ * {{field}} set. The set will not change until the event is
* actually propagated through the system.
*/
- ${generated}
- public void update$upfield ($etype elem)
+ {{generated}}
+ public void update{{upfield}} ({{etype}} elem)
{
- requestEntryUpdate($capfield, $field, elem$transport);
+ requestEntryUpdate({{capfield}}, {{field}}, elem{{transport}});
}
/**
- * Requests that the $field field be set to the
+ * Requests that the {{field}} field be set to the
* specified value. Generally one only adds, updates and removes
* entries of a distributed set, but certain situations call for a
* complete replacement of the set value. The local value will be
@@ -41,10 +41,10 @@
* change. Proxied copies of this object (on clients) will apply the
* value change when they received the attribute changed notification.
*/
- ${generated}
- public void set$upfield ($type value)
+ {{generated}}
+ public void set{{upfield}} ({{type}} value)
{
- requestAttributeChange($capfield, value, this.$field);
- $type clone = $clonefield;
- this.$field = clone;
+ requestAttributeChange({{capfield}}, value, this.{{field}});
+ {{type}} clone = {{clonefield}};
+ this.{{field}} = clone;
}
diff --git a/src/java/com/threerings/presents/tools/marshaller.tmpl b/src/java/com/threerings/presents/tools/marshaller.tmpl
index 2cad95c8a..f171aa89b 100644
--- a/src/java/com/threerings/presents/tools/marshaller.tmpl
+++ b/src/java/com/threerings/presents/tools/marshaller.tmpl
@@ -1,58 +1,58 @@
-package $package;
+package {{package}};
import javax.annotation.Generated;
-#foreach ($import in $imports)
-import $import;
-#end
+{{#imports}}
+import {{this}};
+{{/imports}}
/**
- * Provides the implementation of the {@link ${name}Service} interface
+ * Provides the implementation of the {@link {{name}}Service} interface
* that marshalls the arguments and delivers the request to the provider
* on the server. Also provides an implementation of the response listener
* interfaces that marshall the response arguments and deliver them back
* to the requesting client.
*/
-${generated}
-public class ${name}Marshaller extends InvocationMarshaller
- implements ${name}Service
+{{generated}}
+public class {{name}}Marshaller extends InvocationMarshaller
+ implements {{name}}Service
{
-#foreach ($l in $listeners)
+{{#listeners}}
/**
- * Marshalls results to implementations of {@link ${name}Service.${l.name}Listener}.
+ * Marshalls results to implementations of {@link {{name}}Service.{{listenerName}}Listener}.
*/
- public static class ${l.name}Marshaller extends ListenerMarshaller
- implements ${l.name}Listener
+ public static class {{listenerName}}Marshaller extends ListenerMarshaller
+ implements {{listenerName}}Listener
{
-#foreach ($lm in $l.methods)
- /** The method id used to dispatch {@link #$lm.method.name}
+{{#methods}}
+ /** The method id used to dispatch {@link #{{method.name}}}
* responses. */
- public static final int $lm.code = $velocityCount;
+ public static final int {{code}} = {{-index}};
- // from interface ${l.name}Marshaller
- public void $lm.method.name ($lm.getArgList(false))
+ // from interface {{listenerName}}Marshaller
+ public void {{method.name}} ({{getArgList}})
{
_invId = null;
omgr.postEvent(new InvocationResponseEvent(
- callerOid, requestId, $lm.code,
- new Object[] { $lm.getWrappedArgList(false) }, transport));
+ callerOid, requestId, {{code}},
+ new Object[] { {{getWrappedArgList}} }, transport));
}
-#end
+{{/methods}}
@Override // from InvocationMarshaller
-#if ($l.hasParameterizedMethodArgs())
+{{#hasParameterizedMethodArgs}}
@SuppressWarnings("unchecked")
-#end
+{{/hasParameterizedMethodArgs}}
public void dispatchResponse (int methodId, Object[] args)
{
switch (methodId) {
-#foreach ($lm in $l.methods)
- case $lm.code:
- ((${l.name}Listener)listener).${lm.method.name}(
- ${lm.getUnwrappedArgList(true)});
+{{#methods}}
+ case {{code}}:
+ (({{listenerName}}Listener)listener).{{method.name}}(
+ {{getUnwrappedArgListAsListeners}});
return;
-#end
+{{/methods}}
default:
super.dispatchResponse(methodId, args);
return;
@@ -60,25 +60,26 @@ public class ${name}Marshaller extends InvocationMarshaller
}
}
-#end
-#foreach ($m in $methods)
-#if ($velocityCount > 1)
+{{/listeners}}
+{{#methods}}
+{{^-first}}
-#end
- /** The method id used to dispatch {@link #$m.method.name} requests. */
- public static final int $m.code = $velocityCount;
+{{/-first}}
+ /** The method id used to dispatch {@link #{{method.name}}} requests. */
+ public static final int {{code}} = {{-index}};
- // from interface ${name}Service
- public void $m.method.name ($m.getArgList(false))
+ // from interface {{name}}Service
+ public void {{method.name}} ({{getArgList}})
{
-#foreach ($la in $m.listenerArgs)
- $la.marshaller listener$la.index = new ${la.marshaller}();
- listener${la.index}.listener = arg$la.index;
-#end
- sendRequest(arg1, $m.code, new Object[] {#if($m.hasArgs(true))
-
- $m.getWrappedArgList(true)
- #end}$m.transport);
+{{#listenerArgs}}
+ {{marshaller}} listener{{index}} = new {{marshaller}}();
+ listener{{index}}.listener = arg{{index}};
+{{/listenerArgs}}
+ sendRequest(arg1, {{code}}, new Object[] {
+{{#hasArgsSkipFirst}}
+ {{getWrappedArgListSkipFirst}}
+{{/hasArgsSkipFirst}}
+ }{{transport}});
}
-#end
+{{/methods}}
}
diff --git a/src/java/com/threerings/presents/tools/marshaller_as.tmpl b/src/java/com/threerings/presents/tools/marshaller_as.tmpl
index 94d7599e5..66185877b 100644
--- a/src/java/com/threerings/presents/tools/marshaller_as.tmpl
+++ b/src/java/com/threerings/presents/tools/marshaller_as.tmpl
@@ -1,38 +1,37 @@
-package $package {
+package {{package}} {
-#foreach ($import in $imports)
-import $import;
-#end
+{{#imports}}
+import {{this}};
+{{/imports}}
/**
- * Provides the implementation of the ${name}Service interface
+ * Provides the implementation of the {{name}}Service interface
* that marshalls the arguments and delivers the request to the provider
* on the server. Also provides an implementation of the response listener
* interfaces that marshall the response arguments and deliver them back
* to the requesting client.
*/
-public class ${name}Marshaller extends InvocationMarshaller
- implements ${name}Service
+public class {{name}}Marshaller extends InvocationMarshaller
+ implements {{name}}Service
{
-#foreach ($m in $methods)
-#if ($velocityCount > 1)
+{{#methods}}
+{{^-first}}
-#end
- /** The method id used to dispatch $m.method.name requests. */
- public static const $m.code :int = $velocityCount;
+{{/-first}}
+ /** The method id used to dispatch {{method.name}} requests. */
+ public static const {{code}} :int = {{-index}};
- // from interface ${name}Service
- public function $m.method.name ($m.getASArgList(true)) :void
+ // from interface {{name}}Service
+ public function {{method.name}} ({{getASArgListSkipFirst}}) :void
{
-#foreach ($la in $m.listenerArgs)
-#set ($argIdx = $la.index - 1)
- var listener$argIdx :$la.actionScriptMarshaller = new ${la.actionScriptMarshaller}();
- listener${argIdx}.listener = arg$argIdx;
-#end
- sendRequest($m.code, [
- $m.getASWrappedArgList(true)
+{{#listenerArgs}}
+ var listener{{indexSkipFirst}} :{{actionScriptMarshaller}} = new {{actionScriptMarshaller}}();
+ listener{{indexSkipFirst}}.listener = arg{{indexSkipFirst}};
+{{/listenerArgs}}
+ sendRequest({{code}}, [
+ {{getASWrappedArgListSkipFirst}}
]);
}
-#end
+{{/methods}}
}
}
diff --git a/src/java/com/threerings/presents/tools/marshaller_listener_as.tmpl b/src/java/com/threerings/presents/tools/marshaller_listener_as.tmpl
index 6aa510e84..992a76bff 100644
--- a/src/java/com/threerings/presents/tools/marshaller_listener_as.tmpl
+++ b/src/java/com/threerings/presents/tools/marshaller_listener_as.tmpl
@@ -1,31 +1,31 @@
-package $package {
+package {{package}} {
-#foreach ($import in $imports)
-import $import;
-#end
+{{#imports}}
+import {{this}};
+{{/imports}}
/**
- * Marshalls instances of the ${name}Service_${listener.name}Marshaller interface.
+ * Marshalls instances of the {{name}}Service_{{listener.listenerName}}Marshaller interface.
*/
-public class ${name}Marshaller_${listener.name}Marshaller
+public class {{name}}Marshaller_{{listener.listenerName}}Marshaller
extends InvocationMarshaller_ListenerMarshaller
{
-#foreach ($lm in $listener.methods)
- /** The method id used to dispatch $lm.method.name responses. */
- public static const $lm.code :int = $velocityCount;
+{{#listener.methods}}
+ /** The method id used to dispatch {{method.name}} responses. */
+ public static const {{code}} :int = {{-index}};
-#end
+{{/listener.methods}}
// from InvocationMarshaller_ListenerMarshaller
override public function dispatchResponse (methodId :int, args :Array) :void
{
switch (methodId) {
-#foreach ($lm in $listener.methods)
- case $lm.code:
- (listener as ${name}Service_${listener.name}Listener).${lm.method.name}(
- ${lm.getASUnwrappedArgList(true)});
+{{#listener.methods}}
+ case {{code}}:
+ (listener as {{name}}Service_{{listener.listenerName}}Listener).{{method.name}}(
+ {{getASUnwrappedArgListAsListeners}});
return;
-#end
+{{/listener.methods}}
default:
super.dispatchResponse(methodId, args);
return;
diff --git a/src/java/com/threerings/presents/tools/provider.tmpl b/src/java/com/threerings/presents/tools/provider.tmpl
index 6661651ad..c1e34c31d 100644
--- a/src/java/com/threerings/presents/tools/provider.tmpl
+++ b/src/java/com/threerings/presents/tools/provider.tmpl
@@ -1,26 +1,26 @@
-package $package;
+package {{package}};
import javax.annotation.Generated;
-#foreach ($import in $imports)
-import $import;
-#end
+{{#imports}}
+import {{this}};
+{{/imports}}
/**
- * Defines the server-side of the {@link ${name}Service}.
+ * Defines the server-side of the {@link {{name}}Service}.
*/
-${generated}
-public interface ${name}Provider extends InvocationProvider
+{{generated}}
+public interface {{name}}Provider extends InvocationProvider
{
-#foreach ($m in $methods)
-#if ($velocityCount > 1)
+{{#methods}}
+{{^-first}}
-#end
+{{/-first}}
/**
- * Handles a {@link ${name}Service#$m.method.name} request.
+ * Handles a {@link {{name}}Service#{{method.name}}} request.
*/
- void $m.method.name (ClientObject caller#if ($m.hasArgs(true)), #end$m.getArgList(true))#if ($m.listenerArgs.size() > 0)
+ void {{method.name}} (ClientObject caller{{#hasArgsSkipFirst}}, {{/hasArgsSkipFirst}}{{getArgListSkipFirst}}){{^listenerArgs.isEmpty}}
- throws InvocationException#end;
-#end
+ throws InvocationException{{/listenerArgs.isEmpty}};
+{{/methods}}
}
diff --git a/src/java/com/threerings/presents/tools/sender.tmpl b/src/java/com/threerings/presents/tools/sender.tmpl
index 5774bb569..304b4bc6e 100644
--- a/src/java/com/threerings/presents/tools/sender.tmpl
+++ b/src/java/com/threerings/presents/tools/sender.tmpl
@@ -1,27 +1,27 @@
-package $package;
+package {{package}};
-#foreach ($import in $imports)
-import $import;
-#end
+{{#imports}}
+import {{this}};
+{{/imports}}
/**
- * Used to issue notifications to a {@link ${name}Receiver} instance on a
+ * Used to issue notifications to a {@link {{name}}Receiver} instance on a
* client.
*/
-public class ${name}Sender extends InvocationSender
+public class {{name}}Sender extends InvocationSender
{
-#foreach ($m in $methods)
+{{#methods}}
/**
* Issues a notification that will result in a call to {@link
- * ${name}Receiver#$m.method.name} on a client.
+ * {{name}}Receiver#{{method.name}}} on a client.
*/
- public static void $m.senderMethodName (
- ClientObject target#if ($m.hasArgs(false)), #end$m.getArgList(false))
+ public static void {{senderMethodName}} (
+ ClientObject target{{#hasArgs}}, {{/hasArgs}}{{getArgList}})
{
sendNotification(
- target, ${name}Decoder.RECEIVER_CODE, ${name}Decoder.$m.code,
- new Object[] { $m.getWrappedArgList(false) }$m.transport);
+ target, {{name}}Decoder.RECEIVER_CODE, {{name}}Decoder.{{code}},
+ new Object[] { {{getWrappedArgList}} }{{transport}});
}
-#end
+{{/methods}}
}
diff --git a/src/java/com/threerings/presents/tools/service_as.tmpl b/src/java/com/threerings/presents/tools/service_as.tmpl
index cce5a8848..00ff65b48 100644
--- a/src/java/com/threerings/presents/tools/service_as.tmpl
+++ b/src/java/com/threerings/presents/tools/service_as.tmpl
@@ -1,20 +1,20 @@
-package $package {
+package {{package}} {
-#foreach ($import in $imports)
-import $import;
-#end
+{{#imports}}
+import {{this}};
+{{/imports}}
/**
- * An ActionScript version of the Java ${name}Service interface.
+ * An ActionScript version of the Java {{name}}Service interface.
*/
-public interface ${name}Service extends InvocationService
+public interface {{name}}Service extends InvocationService
{
-#foreach ($m in $methods)
-#if ($velocityCount > 1)
+{{#methods}}
+{{^-first}}
-#end
- // from Java interface ${name}Service
- function $m.method.name ($m.getASArgList(true)) :void;
-#end
+{{/-first}}
+ // from Java interface {{name}}Service
+ function {{method.name}} ({{getASArgListSkipFirst}}) :void;
+{{/methods}}
}
}
diff --git a/src/java/com/threerings/presents/tools/service_listener_adapter_as.tmpl b/src/java/com/threerings/presents/tools/service_listener_adapter_as.tmpl
index df6247a27..086228d96 100644
--- a/src/java/com/threerings/presents/tools/service_listener_adapter_as.tmpl
+++ b/src/java/com/threerings/presents/tools/service_listener_adapter_as.tmpl
@@ -1,48 +1,37 @@
-package $package {
+package {{package}} {
-#foreach ($import in $imports)
-import $import;
-#end
+{{#imports}}
+import {{this}};
+{{/imports}}
/**
- * A functional adapter for the ${name}Service_${listener.name}Listener interface.
+ * A functional adapter for the {{name}}Service_{{listener.listenerName}}Listener interface.
*/
-public class ${name}Service_${listener.name}ListenerAdapter
- implements ${name}Service_${listener.name}Listener
+public class {{name}}Service_{{listener.listenerName}}ListenerAdapter
+ implements {{name}}Service_{{listener.listenerName}}Listener
{
-#set ($cparams = "")
-#foreach ($lm in $listener.methods)
-#set ($cparams = $cparams + "$lm.method.name :Function, ")
-#end
/**
- * Creates a new $name service $listener.name listener that will delegate to the given
- * function(s). Any Function that is null will simply not be called.
+ * Creates a new {{name}} service {{listener.listenerName}} listener that will delegate to the
+ * given function(s). Any Function that is null will simply not be called.
*/
- public function ${name}Service_${listener.name}ListenerAdapter (
- ${cparams}failed :Function)
+ public function {{name}}Service_{{listener.listenerName}}ListenerAdapter (
+ {{adapterCtorArgs}}failed :Function)
{
-#foreach ($lm in $listener.methods)
- _$lm.method.name = $lm.method.name;
-#end
+{{#listener.methods}}
+ _{{method.name}} = {{method.name}};
+{{/listener.methods}}
_failed = failed;
}
-#foreach ($lm in $listener.methods)
+{{#listener.methods}}
- // from Java ${name}Service_${listener.name}Listener
- public function $lm.method.name ($lm.getASArgList(false)) :void
+ // from Java {{name}}Service_{{listener.listenerName}}Listener
+ public function {{method.name}} ({{getASArgList}}) :void
{
-#set ($alist = "")
-#foreach ($type in $lm.method.getParameterTypes())
-#if ($velocityCount > 1)
-#set ($alist = $alist + ", ")
-#end
-#set ($alist = $alist + "arg$velocityCount")
-#end
- if (_$lm.method.name != null) {
- _${lm.method.name}($alist);
+ if (_{{method.name}} != null) {
+ _{{method.name}}({{getASInvokeArgList}});
}
}
-#end
+{{/listener.methods}}
// from InvocationService_InvocationListener
public function requestFailed (cause :String) :void
@@ -52,9 +41,9 @@ public class ${name}Service_${listener.name}ListenerAdapter
}
}
-#foreach ($lm in $listener.methods)
- protected var _$lm.method.name :Function;
-#end
+{{#listener.methods}}
+ protected var _{{method.name}} :Function;
+{{/listener.methods}}
protected var _failed :Function;
}
}
diff --git a/src/java/com/threerings/presents/tools/service_listener_as.tmpl b/src/java/com/threerings/presents/tools/service_listener_as.tmpl
index 317911b2c..394ab86bc 100644
--- a/src/java/com/threerings/presents/tools/service_listener_as.tmpl
+++ b/src/java/com/threerings/presents/tools/service_listener_as.tmpl
@@ -1,21 +1,21 @@
-package $package {
+package {{package}} {
-#foreach ($import in $imports)
-import $import;
-#end
+{{#imports}}
+import {{this}};
+{{/imports}}
/**
- * An ActionScript version of the Java ${name}Service_${listener.name}Listener interface.
+ * An ActionScript version of the Java {{name}}Service_{{listener.listenerName}}Listener interface.
*/
-public interface ${name}Service_${listener.name}Listener
+public interface {{name}}Service_{{listener.listenerName}}Listener
extends InvocationService_InvocationListener
{
-#foreach ($lm in $listener.methods)
-#if ($velocityCount > 1)
+{{#listener.methods}}
+{{^-first}}
-#end
- // from Java ${name}Service_${listener.name}Listener
- function $lm.method.name ($lm.getASArgList(false)) :void
-#end
+{{/-first}}
+ // from Java {{name}}Service_{{listener.listenerName}}Listener
+ function {{method.name}} ({{getASArgList}}) :void
+{{/listener.methods}}
}
}
diff --git a/src/java/com/threerings/presents/tools/streamable_as.tmpl b/src/java/com/threerings/presents/tools/streamable_as.tmpl
index 5b05ba4cf..492b1b68d 100644
--- a/src/java/com/threerings/presents/tools/streamable_as.tmpl
+++ b/src/java/com/threerings/presents/tools/streamable_as.tmpl
@@ -1,46 +1,45 @@
// GENERATED PREAMBLE START
-${header}
-package ${package} {
+{{header}}
+package {{package}} {
-#foreach ($import in $imports)
-import $import;
-#end
+{{#imports}}
+import {{this}};
+{{/imports}}
// GENERATED PREAMBLE END
// GENERATED CLASSDECL START
-public class ${classname} #if (!${extends.isEmpty()})extends $extends
-#end
-#if (!${implements.isEmpty()})
-#if (!${extends.isEmpty()}) #{end}implements $implements
-#end
+public class {{classname}} {{^extends.isEmpty}}extends {{#extends}}
+{{/extends.isEmpty}}
+{{^implements.isEmpty}}{{^extends.isEmpty}} {{/extends.isEmpty}}implements {{#implements}}
+{{/implements.isEmpty}}
{
// GENERATED CLASSDECL END
// GENERATED STREAMING START
-#foreach ($field in $fields)
- public var $field.name :${field.simpleType};
-#end
+{{#fields}}
+ public var {{name}} :{{simpleType}};
+{{/fields}}
- #if ($superclassStreamable)override #{end}public function readObject (ins :ObjectInputStream) :void
+ {{#superclassStreamable}}override {{/superclassStreamable}}public function readObject (ins :ObjectInputStream) :void
{
-#if ($superclassStreamable)
+{{#superclassStreamable}}
super.readObject(ins);
-#end
-#foreach ($field in $fields)
- $field.name = ins.${field.reader};
-#end
+{{/superclassStreamable}}
+{{#fields}}
+ {{name}} = ins.{{reader}};
+{{/fields}}
}
- #if ($superclassStreamable)override #{end}public function writeObject (out :ObjectOutputStream) :void
+ {{#superclassStreamable}}override {{/superclassStreamable}}public function writeObject (out :ObjectOutputStream) :void
{
-#if ($superclassStreamable)
+{{#superclassStreamable}}
super.writeObject(out);
-#end
-#foreach ($field in $fields)
- out.${field.writer};
-#end
+{{/superclassStreamable}}
+{{#fields}}
+ out.{{writer}};
+{{/fields}}
}
// GENERATED STREAMING END
}
-}
\ No newline at end of file
+}