| ## |
| ## Licensed to the Apache Software Foundation (ASF) under one |
| ## or more contributor license agreements. See the NOTICE file |
| ## distributed with this work for additional information |
| ## regarding copyright ownership. The ASF licenses this file |
| ## to you under the Apache License, Version 2.0 (the |
| ## "License"); you may not use this file except in compliance |
| ## with the License. You may obtain a copy of the License at |
| ## |
| ## http://www.apache.org/licenses/LICENSE-2.0 |
| ## |
| ## Unless required by applicable law or agreed to in writing, software |
| ## distributed under the License is distributed on an "AS IS" BASIS, |
| ## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| ## See the License for the specific language governing permissions and |
| ## limitations under the License. |
| ## |
| #if ($protocol.getNamespace()) |
| package $protocol.getNamespace(); |
| #end |
| |
| @SuppressWarnings("all") |
| #if ($protocol.getDoc()) |
| /** $protocol.getDoc() */ |
| #end |
| public interface $this.mangle($protocol.getName()) { |
| public static final org.apache.avro.Protocol PROTOCOL = org.apache.avro.Protocol.parse("${this.javaEscape($protocol.toString())}"); |
| #foreach ($e in $protocol.getMessages().entrySet()) |
| #set ($name = $e.getKey()) |
| #set ($message = $e.getValue()) |
| #set ($response = $message.getResponse()) |
| #if ($message.getDoc()) |
| /** $this.escapeForJavadoc($message.getDoc()) */ |
| #end |
| #if ($message.isOneWay())void#else${this.javaUnbox($response)}#end |
| ${this.mangle($name)}(## |
| #foreach ($p in $message.getRequest().getFields())## |
| #* *#${this.javaUnbox($p.schema())} ${this.mangle($p.name())}#if ($velocityHasNext), #end |
| #end |
| )#if (! $message.isOneWay()) |
| throws org.apache.avro.AvroRemoteException## |
| ## The first error is always "string", so we skip it. |
| #foreach ($error in $message.getErrors().getTypes().subList(1, $message.getErrors().getTypes().size())) |
| , ${this.mangle($error.getFullName())}## |
| #end## (error list) |
| #end## (one way) |
| ; |
| #end## (requests) |
| } |