Download Sources

com.liguorien.flex.generator.writers.as3
Class AS3Writer

java.lang.Object
  extended by com.liguorien.flex.generator.writers.as3.AS3Writer
All Implemented Interfaces:
ClassWriter
Direct Known Subclasses:
TextElement

public class AS3Writer
extends java.lang.Object
implements ClassWriter

Version:
0.2
Author:
Nicolas Désy

Field Summary
static AS3Writer WRITER
           
 
Constructor Summary
AS3Writer()
           
 
Method Summary
 int getClassIndentationLevel()
          Returns the indentation level of the class declaration
static ClassWriter getContextWriter()
           
static java.lang.String getTypeName(java.lang.Class type)
          Returns the AS3 classname of a Java type.
static void setContextWriter(ClassWriter w)
           
 void writeClassDeclaration(java.io.Writer w, FlexGenerator g, java.lang.String className, java.lang.String subClass, java.util.Set<java.lang.String> interfaces)
          Writes package declaration
 void writeClassEnd(java.io.Writer w, FlexGenerator g)
          Writes class's end declaration.
 void writePackageDeclaration(java.io.Writer w, FlexGenerator g, java.lang.Class<?> clazz, java.util.Set<java.lang.String> imports)
          Writes package declaration
 void writeProperty(java.io.Writer w, FlexGenerator g, java.lang.String varName, java.beans.PropertyDescriptor prop, java.lang.String e4xPrefix, java.lang.String e4xSuffix, NodeType type)
          Writes code to access a property.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

WRITER

public static final AS3Writer WRITER
Constructor Detail

AS3Writer

public AS3Writer()
Method Detail

getContextWriter

public static ClassWriter getContextWriter()

setContextWriter

public static void setContextWriter(ClassWriter w)

getClassIndentationLevel

public int getClassIndentationLevel()
Description copied from interface: ClassWriter
Returns the indentation level of the class declaration

Specified by:
getClassIndentationLevel in interface ClassWriter
Returns:
An integer which represents the indentation level (ie. java=0, as3=1)

getTypeName

public static java.lang.String getTypeName(java.lang.Class type)
Returns the AS3 classname of a Java type.

Parameters:
type - A Java class
Returns:
The classname of the AS3 equivalent type

writeProperty

public void writeProperty(java.io.Writer w,
                          FlexGenerator g,
                          java.lang.String varName,
                          java.beans.PropertyDescriptor prop,
                          java.lang.String e4xPrefix,
                          java.lang.String e4xSuffix,
                          NodeType type)
                   throws java.io.IOException
Description copied from interface: ClassWriter
Writes code to access a property.

Specified by:
writeProperty in interface ClassWriter
Parameters:
w - The writer used to output the result
g - The current generator.
varName - The name of variable where the property is accessed
prop - The ProspectorDescriptor of the current property
e4xPrefix - The code to be written before generated code (can be null)
e4xSuffix - The code to be written after generated code (can be null)
type - The type of XML element for this property
Throws:
java.io.IOException - If an IO error occurs
See Also:
NodeType

writePackageDeclaration

public void writePackageDeclaration(java.io.Writer w,
                                    FlexGenerator g,
                                    java.lang.Class<?> clazz,
                                    java.util.Set<java.lang.String> imports)
                             throws java.io.IOException
Description copied from interface: ClassWriter
Writes package declaration

Specified by:
writePackageDeclaration in interface ClassWriter
Parameters:
w - The writer used to output the result
g - The current generator.
clazz - The current class
imports - A Set of import statement.
Throws:
java.io.IOException - If an IO error occurs

writeClassDeclaration

public void writeClassDeclaration(java.io.Writer w,
                                  FlexGenerator g,
                                  java.lang.String className,
                                  java.lang.String subClass,
                                  java.util.Set<java.lang.String> interfaces)
                           throws java.io.IOException
Description copied from interface: ClassWriter
Writes package declaration

Specified by:
writeClassDeclaration in interface ClassWriter
Parameters:
w - The writer used to output the result
g - The current generator.
className - The name of the generated class
subClass - The subclass of the generated class (can be null)
interfaces - The interfaces implemented by the generated class (can be null)
Throws:
java.io.IOException

writeClassEnd

public void writeClassEnd(java.io.Writer w,
                          FlexGenerator g)
                   throws java.io.IOException
Description copied from interface: ClassWriter
Writes class's end declaration. Typically a closing curly brace.

Specified by:
writeClassEnd in interface ClassWriter
Parameters:
w - The writer used to output the result
g - The current generator
Throws:
java.io.IOException

FlexGenerator

Copyright 2006 Nicolas Désy. All rights reserved.