org.codehaus.enunciate.modules.gwt.gwt-endpoint-interface.fmt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of enunciate-gwt Show documentation
Show all versions of enunciate-gwt Show documentation
The Enunciate GWT module generates the artifacts to support the GWT application.
[#ftl]
[#--template for the client-side endpoint interface.--]
[@file name=(endpointInterface.simpleName + ".java") package=packageFor(endpointInterface) charset="utf-8"]
/**
* ${(generatedCodeLicense!"")?replace("\n", "\n * ")}
*
* Generated by Enunciate.
*/
package ${packageFor(endpointInterface)};
/**
* ${endpointInterface.docComment?default("(no documentation provided)")?chop_linebreak?replace("\n", "\n * ")}
*/
public interface ${endpointInterface.simpleName} extends com.google.gwt.user.client.rpc.RemoteService {
[@forEachWebMethod endpointInterface=endpointInterface considerFacets="true"]
/**
* ${webMethod.docComment?default("(no documentation provided)")?chop_linebreak?replace("\n", "\n * ")}
*/
${classnameFor(webMethod.webResult)} ${webMethod.simpleName}([#list webMethod.webParameters as param]${classnameFor(param)} ${param.simpleName}[#if param_has_next], [/#if][/#list]) [#if webMethod.webFaults?size > 0]throws [#list webMethod.webFaults as fault]${classnameFor(fault)}[#if fault_has_next], [/#if][/#list][/#if];
[/@forEachWebMethod]
}
[/@file]
[@file name=(endpointInterface.simpleName + "Async.java") package=packageFor(endpointInterface) charset="utf-8"]
/**
* ${(generatedCodeLicense!"")?replace("\n", "\n * ")}
*
* Generated by Enunciate.
*/
package ${packageFor(endpointInterface)};
/**
* ${endpointInterface.docComment?default("(no documentation provided)")?chop_linebreak?replace("\n", "\n * ")}
*/
public interface ${endpointInterface.simpleName}Async {
/**
* Utility class for getting an instance of the async interface for ${endpointInterface.simpleName}.
*/
public static class Util {
/**
* Get an instance of this async interface for ${endpointInterface.simpleName}. This method assumes the endpoint is
* mounted at "${baseDeploymentAddress}${gwtSubcontext}/${endpointInterface.serviceName}".
*
* @return The async instance.
*/
public static ${endpointInterface.simpleName}Async getInstance() {
return getInstance("${baseDeploymentAddress}${gwtSubcontext}/${endpointInterface.serviceName}");
}
/**
* Get an instance of this async interface for ${endpointInterface.simpleName}. This method assumes the endpoint is
* mounted at url + "${gwtSubcontext[1..]}/${endpointInterface.serviceName}".
*
* @return The async instance.
*/
public static ${endpointInterface.simpleName}Async getInstanceRelativeToUrl(String url) {
return getInstance(url + "${gwtSubcontext[1..]}/${endpointInterface.serviceName}");
}
/**
* Get an instance of this async interface for ${endpointInterface.simpleName}.
*
* @param url The url where the remote endpoint is mounted.
* @return The async instance.
*/
public static ${endpointInterface.simpleName}Async getInstance(String url) {
${endpointInterface.simpleName}Async asyncInstance = (${endpointInterface.simpleName}Async) com.google.gwt.core.client.GWT.create(${endpointInterface.simpleName}.class);
((com.google.gwt.user.client.rpc.ServiceDefTarget) asyncInstance).setServiceEntryPoint(url);
return asyncInstance;
}
}
[@forEachWebMethod endpointInterface=endpointInterface considerFacets="true"]
/**
* ${webMethod.docComment?default("(no documentation provided)")?chop_linebreak?replace("\n", "\n * ")}
*/
void ${webMethod.simpleName}([#list webMethod.webParameters as param]${classnameFor(param)} ${param.simpleName}, [/#list]com.google.gwt.user.client.rpc.AsyncCallback<[#if webMethod.returnType.void]Void[#elseif !webMethod.returnType.primitive]${classnameFor(webMethod.webResult)}[#else][@primitiveWrapper type=webMethod.returnType/][/#if]> callback);
[/@forEachWebMethod]
}
[/@file]