
org.granite.generator.template.tideRemoteBase.gsp Maven / Gradle / Ivy
The newest version!
<%--
GRANITE DATA SERVICES
Copyright (C) 2006-2014 GRANITE DATA SERVICES S.A.S.
This file is part of the Granite Data Services Platform.
Granite Data Services is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
Granite Data Services is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser
General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
USA, or see .
@author Franck WOLFF
--%><%
Set as3Imports = new TreeSet();
as3Imports.add("flash.utils.flash_proxy");
if (!jClass.hasSuperclass()) {
as3Imports.add("org.granite.tide.Component");
as3Imports.add("org.granite.tide.BaseContext");
}
as3Imports.add("org.granite.tide.ITideResponder");
as3Imports.add("mx.rpc.AsyncToken");
for (jImport in jClass.imports) {
if (jImport.as3Type.hasPackage() && jImport.as3Type.packageName != jClass.as3Type.packageName)
as3Imports.add(jImport.as3Type.qualifiedName);
}
%>/**
* Generated by Gas3 v${gVersion} (Granite Data Services).
*
* WARNING: DO NOT CHANGE THIS FILE. IT MAY BE OVERWRITTEN EACH TIME YOU USE
* THE GENERATOR. INSTEAD, EDIT THE INHERITED CLASS (${jClass.as3Type.name}.as).
*/
package ${jClass.as3Type.packageName} {
<%
///////////////////////////////////////////////////////////////////////////////
// Write Import Statements.
for (as3Import in as3Imports) {%>
import ${as3Import};<%
}%>
use namespace flash_proxy;<%
///////////////////////////////////////////////////////////////////////////////
// Write Class Declaration.%>
public class ${jClass.as3Type.name}Base<%
if (jClass.hasSuperclass()) {
%> extends ${jClass.superclass.as3Type.name}<%
} else {
%> extends Component<%
}%> {
public function ${jClass.as3Type.name}Base() {
super();
}
<%
///////////////////////////////////////////////////////////////////////////
// Write Public Getter/Setter.
for (jProperty in jClass.properties) {
if (jProperty.readable || jProperty.writable) {%>
<%
if (jProperty.writable) {%>
public <%= jProperty.writeOverride ? "override " : "" %>function set ${jProperty.name}(value:${jProperty.as3Type.name}):void {
super.meta_internalSetProperty("${jProperty.name}", value, true, false);
}<%
}
if (!jProperty.writable) {%>
[Bindable(event="propertyChange")]<%
} else {%>
[Bindable]<%
}%>
public <%= jProperty.readOverride ? "override " : "" %>function get ${jProperty.name}():${jProperty.as3Type.name} {
return super.getProperty("${jProperty.name}") as ${jProperty.as3Type.name};
}<%
}
}
///////////////////////////////////////////////////////////////////////////
// Write Methods.
List writtenMethodNames = [ "delete" ];
for (jMethod in jClass.methods) {%>
<%
String as3MethodName = jMethod.name;
String initialAs3MethodName = as3MethodName;
int num = 1;
while (writtenMethodNames.contains(as3MethodName)) {
as3MethodName = initialAs3MethodName + "_" + num;
num++;
}
writtenMethodNames.add(as3MethodName);
if (jMethod.options != null) {%>
[${jMethod.options}]<%
}
int idx = 0;
for (opt in jMethod.getAs3ParameterOptions()) {
if (opt != null) {%>
[${opt}("${jMethod.getAs3ParameterNames()[idx]}")]<%
}
idx++;
}%>
public function ${as3MethodName}(<%
String[] names = jMethod.getAs3ParameterNames();
int count = 0;
for (pType in jMethod.getAs3ParameterTypes()) {
if (count > 0) {
%>, <%
}
%>${names[count]}:${pType.name}<%
count++;
}
if (count > 0) {%>, <% }%>resultHandler:Object = null, faultHandler:Function = null):AsyncToken {
if (faultHandler != null)
return callProperty("${jMethod.name}"<%
count = 0;
for (pType in jMethod.getAs3ParameterTypes()) {
%>, ${names[count]}<%
count++;
}%>, resultHandler, faultHandler) as AsyncToken;
else if (resultHandler is Function || resultHandler is ITideResponder)
return callProperty("${jMethod.name}"<%
count = 0;
for (pType in jMethod.getAs3ParameterTypes()) {
%>, ${names[count]}<%
count++;
}%>, resultHandler) as AsyncToken;
else if (resultHandler == null)
return callProperty("${jMethod.name}"<%
count = 0;
for (pType in jMethod.getAs3ParameterTypes()) {
%>, ${names[count]}<%
count++;
}%>) as AsyncToken;
else
throw new Error("Illegal argument to remote call (last argument should be Function or ITideResponder): " + resultHandler);
}<%
}%>
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy