I'm using GraniteDS Actionscript code generation templates that let's me take a Java object and convert it to an Actionscript class.
It's mainly used for BlazeDS Java to Flash communication but I'm adapting it to work with JSON webservices using XStream/JETTISON JSON.
Is it possible to use the Granite DS Groovy templates to inspect annotations on a Java class and use that to generate the code bindings?
For example I create an @XStreamAlias to shorten the class name when sent through JSON, but I need my Actionscript generated classes to support that as well.
package com.webwars.game;
@XStreamAlias("UnitStack")
public class UnitStack implements Serializable {
I want my Actionscript generated code to be:
package com.webwars.gameplatform.combat.pvp {
[Bindable]
[RemoteClass(alias="UnitStack")]
public class UnitStack extends UnitStackBase {
Is this possible with the groovy templates?
I can't seem to find any documentation on what properties are available in the GraniteDS Groovy Template JavaType? The documentation listed on the GraniteDS site for JavaType goes to a broken Javadoc link.
For example in my bean.gsp can I do something like:
<%
///////////////////////////////////////////////////////////////////////////
// Use the XStreamAlias annotation as the classname
def alias = jClass.qualifiedName;
if (jClass.hasAnnotation("XStreamAlias)) {
alias = jClass.getAnnotation("XStreamAlias");
}
%>
[Bindable]
[RemoteClass(alias="${alias}")]
public class ${jClass.as3Type.name} extends ${jClass.as3Type.name}Base {<%