package $package; #foreach ($import in $imports) import $import; #end /** * Dispatches calls to a {@link ${name}Receiver} instance. */ public class ${name}Decoder extends InvocationDecoder { /** The generated hash code used to identify this receiver class. */ public static final String RECEIVER_CODE = "$receiver_code"; #foreach ($m in $methods) /** The method id used to dispatch {@link ${name}Receiver#$m.method.name} * notifications. */ public static final int $m.code = $velocityCount; #end /** * Creates a decoder that may be registered to dispatch invocation * service notifications to the specified receiver. */ public ${name}Decoder (${name}Receiver receiver) { this.receiver = receiver; } // documentation inherited public String getReceiverCode () { return RECEIVER_CODE; } // documentation inherited 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) ); return; #end default: super.dispatchNotification(methodId, args); return; } } }