All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.adgear.avro.plugin.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
##
##     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
#if ($protocol.getDoc())
#foreach ($imp in $this.javaImports($protocol.getDoc()))
import $imp;
#end

/** $protocol.getDoc() */
@SuppressWarnings("all")
#foreach ($annotation in $this.javaAnnotations($protocol, $protocol.getDoc()))
@$annotation
#end
#else
@SuppressWarnings("all")
#foreach ($annotation in $this.javaAnnotations($protocol))
@$annotation
#end
#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.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()) */
#foreach ($annotation in $this.javaAnnotations($message, #message.getDoc()))
  @$annotation
#end
#else
#foreach ($annotation in $this.javaAnnotations($message))
  @$annotation
#end
#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)

## 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
    void ${this.mangle($name)}(##
#foreach ($p in $message.getRequest().getFields())##
#*      *#${this.javaUnbox($p.schema())} ${this.mangle($p.name())}#if ($velocityHasNext), #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 - 2025 Weber Informatics LLC | Privacy Policy