wavefront.templates.protocol.vm Maven / Gradle / Ivy
##
## 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
##
## https://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
#if ($protocol.getDoc())
/** $protocol.getDoc() */
#end
#foreach ($annotation in $this.javaAnnotations($protocol))
@$annotation
#end
@org.apache.avro.specific.AvroGenerated
public interface $this.mangle($protocol.getName()) {
public static final org.apache.avro.Protocol PROTOCOL = org.apache.avro.Protocol.parse(${this.javaSplit($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
#foreach ($p in $message.getRequest().getFields())##
#if ($p.doc()) * @param ${this.mangle($p.name())} $p.doc()
#end
#end
*/
#foreach ($annotation in $this.javaAnnotations($message))
@$annotation
#end
#if ($message.isOneWay())void#else${this.javaUnbox($response, true)}#end
${this.mangle($name)}(##
#foreach ($p in $message.getRequest().getFields())##
#* *#${this.javaUnbox($p.schema())} ${this.mangle($p.name())}#if ($foreach.hasNext), #end
#end
)#if (! $message.isOneWay() && $message.getErrors().getTypes().size() > 1)
throws ##
## 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())}##
#if ($foreach.hasNext), #end
#end## (error list)
#end## (one way)
;
#end## (requests)
## Generate nested callback API
@SuppressWarnings("all")
#if ($protocol.getDoc())
/** $protocol.getDoc() */
#end
public interface Callback extends $this.mangle($protocol.getName()) {
public static final org.apache.avro.Protocol PROTOCOL = #if ($protocol.getNamespace())$protocol.getNamespace().#end${this.mangle($protocol.getName())}.PROTOCOL;
#foreach ($e in $protocol.getMessages().entrySet())
#set ($name = $e.getKey())
#set ($message = $e.getValue())
#set ($response = $message.getResponse())
## Generate callback method if the message is not one-way:
#if (! $message.isOneWay())
/**
#if ($message.getDoc())
* $this.escapeForJavadoc($message.getDoc())
#end
#foreach ($p in $message.getRequest().getFields())##
#if ($p.doc()) * @param ${this.mangle($p.name())} $p.doc()
#end
#end
* @throws java.io.IOException The async call could not be completed.
*/
void ${this.mangle($name)}(##
#foreach ($p in $message.getRequest().getFields())##
#* *#${this.javaUnbox($p.schema())} ${this.mangle($p.name())}#if ($foreach.hasNext), #end
#end
#if ($message.getRequest().getFields().size() > 0), #end
org.apache.avro.ipc.Callback<${this.javaType($response)}> callback) throws java.io.IOException;
#end## (generate callback method)
#end## (requests)
}## End of Callback interface
}## End of protocol interface
© 2015 - 2024 Weber Informatics LLC | Privacy Policy