org.nuiton.guix.generator
Class GuixGenerator

java.lang.Object
  extended by org.nuiton.guix.generator.GuixGenerator
All Implemented Interfaces:
Generator

public abstract class GuixGenerator
extends java.lang.Object
implements Generator

Abstract class of the Guix generators.

Author:
kevin

Field Summary
protected  java.util.Map<java.lang.String,java.util.Map<java.lang.String,java.lang.String>> bindings2Generate
          Maps the field name with a map of the attribute and its value
protected  java.util.Map<java.lang.String,JavaFile> classes
          List of the classes to generate
protected  java.util.List<java.io.File> cssFiles
          List of the CSS files needed of the generation
protected  java.io.File destDir
          Destination directory of the generated file
protected  GuixModelObject gmo
          GuixModelObject which represents the class to generate
protected  java.lang.Long lastModification
          Time of the last modification of one of the file implied in the process
protected  java.lang.String launcherName
          Name to give to the generated launcher
protected  boolean mainClass
          True if the class to generate is teh main class of the application
protected  java.util.List<JavaFile> propertyChangeListenerDependencies
          List of the user file names containing the addPropertyChangeListener method
protected  org.xmlpull.v1.XmlSerializer serializer
          XML serializer to generate the spring conf
protected  java.io.File srcDir
          Source directory
 
Constructor Summary
GuixGenerator()
           
 
Method Summary
abstract  JavaFile generate()
          Generates a JavaFile
abstract  java.util.List<java.lang.Class> generateBindings(java.lang.StringBuffer dbCreation, java.lang.StringBuffer dbDeletion, TagHandler prevTh, JavaFile jf, java.lang.Class clazz, java.lang.String[] binding, int i, java.util.List<java.lang.String> alreadyChecked, java.lang.String methodToInvoke, java.util.Map<GuixGenerator,JavaFile> generatedFiles)
          Checks if the objects of the binding exist and determines which objects need a listener
 java.util.Map<java.lang.String,java.util.Map<java.lang.String,java.lang.String>> getBindingsToGenerate()
           
 java.util.Map<java.lang.String,JavaFile> getClasses()
           
 java.util.List<java.io.File> getCSSFiles()
           
 java.io.File getDestDir()
           
 GuixModelObject getGmo()
           
 java.lang.Long getLastModification()
           
 java.lang.String getLauncherName()
           
 java.util.List<JavaFile> getPropertyChangeListenerDependencies()
           
 org.xmlpull.v1.XmlSerializer getSerializer()
           
 java.io.File getSrcDir()
           
 boolean isMainClass()
           
abstract  void saveFiles()
          Saves the generated files
 void setBindingsToGenerate(java.util.Map<java.lang.String,java.util.Map<java.lang.String,java.lang.String>> bindings2Generate)
           
 void setClasses(java.util.Map<java.lang.String,JavaFile> classes)
           
 void setCSSFiles(java.util.List<java.io.File> cssFiles)
           
 void setDestDir(java.io.File destDir)
           
 void setGmo(GuixModelObject gmo)
           
 void setLastModification(java.lang.Long lastModification)
           
 void setLauncherName(java.lang.String launcherName)
           
 void setMainClass(boolean mainClass)
           
 void setPropertyChangeListenerDependencies(java.util.List<JavaFile> propertyChangeListenerDependencies)
           
 void setSerializer(org.xmlpull.v1.XmlSerializer serializer)
           
 void setSrcDir(java.io.File srcDir)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

gmo

protected GuixModelObject gmo
GuixModelObject which represents the class to generate


srcDir

protected java.io.File srcDir
Source directory


destDir

protected java.io.File destDir
Destination directory of the generated file


mainClass

protected boolean mainClass
True if the class to generate is teh main class of the application


lastModification

protected java.lang.Long lastModification
Time of the last modification of one of the file implied in the process


serializer

protected org.xmlpull.v1.XmlSerializer serializer
XML serializer to generate the spring conf


classes

protected java.util.Map<java.lang.String,JavaFile> classes
List of the classes to generate


cssFiles

protected java.util.List<java.io.File> cssFiles
List of the CSS files needed of the generation


launcherName

protected java.lang.String launcherName
Name to give to the generated launcher


bindings2Generate

protected java.util.Map<java.lang.String,java.util.Map<java.lang.String,java.lang.String>> bindings2Generate
Maps the field name with a map of the attribute and its value


propertyChangeListenerDependencies

protected java.util.List<JavaFile> propertyChangeListenerDependencies
List of the user file names containing the addPropertyChangeListener method

Constructor Detail

GuixGenerator

public GuixGenerator()
Method Detail

generate

public abstract JavaFile generate()
Generates a JavaFile

Specified by:
generate in interface Generator
Returns:
the JavaFile generated

getSrcDir

public java.io.File getSrcDir()
Specified by:
getSrcDir in interface Generator

setSrcDir

public void setSrcDir(java.io.File srcDir)
Specified by:
setSrcDir in interface Generator

getDestDir

public java.io.File getDestDir()
Specified by:
getDestDir in interface Generator

setDestDir

public void setDestDir(java.io.File destDir)
Specified by:
setDestDir in interface Generator

getGmo

public GuixModelObject getGmo()
Specified by:
getGmo in interface Generator

setGmo

public void setGmo(GuixModelObject gmo)
Specified by:
setGmo in interface Generator

getLastModification

public java.lang.Long getLastModification()
Specified by:
getLastModification in interface Generator

setLastModification

public void setLastModification(java.lang.Long lastModification)
Specified by:
setLastModification in interface Generator

isMainClass

public boolean isMainClass()
Specified by:
isMainClass in interface Generator

setMainClass

public void setMainClass(boolean mainClass)
Specified by:
setMainClass in interface Generator

getSerializer

public org.xmlpull.v1.XmlSerializer getSerializer()
Specified by:
getSerializer in interface Generator

setSerializer

public void setSerializer(org.xmlpull.v1.XmlSerializer serializer)
Specified by:
setSerializer in interface Generator

getClasses

public java.util.Map<java.lang.String,JavaFile> getClasses()
Specified by:
getClasses in interface Generator

setClasses

public void setClasses(java.util.Map<java.lang.String,JavaFile> classes)
Specified by:
setClasses in interface Generator

getCSSFiles

public java.util.List<java.io.File> getCSSFiles()
Specified by:
getCSSFiles in interface Generator

setCSSFiles

public void setCSSFiles(java.util.List<java.io.File> cssFiles)
Specified by:
setCSSFiles in interface Generator

getLauncherName

public java.lang.String getLauncherName()
Specified by:
getLauncherName in interface Generator

setLauncherName

public void setLauncherName(java.lang.String launcherName)
Specified by:
setLauncherName in interface Generator

getBindingsToGenerate

public java.util.Map<java.lang.String,java.util.Map<java.lang.String,java.lang.String>> getBindingsToGenerate()

setBindingsToGenerate

public void setBindingsToGenerate(java.util.Map<java.lang.String,java.util.Map<java.lang.String,java.lang.String>> bindings2Generate)

getPropertyChangeListenerDependencies

public java.util.List<JavaFile> getPropertyChangeListenerDependencies()
Specified by:
getPropertyChangeListenerDependencies in interface Generator

setPropertyChangeListenerDependencies

public void setPropertyChangeListenerDependencies(java.util.List<JavaFile> propertyChangeListenerDependencies)
Specified by:
setPropertyChangeListenerDependencies in interface Generator

saveFiles

public abstract void saveFiles()
Saves the generated files


generateBindings

public abstract java.util.List<java.lang.Class> generateBindings(java.lang.StringBuffer dbCreation,
                                                                 java.lang.StringBuffer dbDeletion,
                                                                 TagHandler prevTh,
                                                                 JavaFile jf,
                                                                 java.lang.Class clazz,
                                                                 java.lang.String[] binding,
                                                                 int i,
                                                                 java.util.List<java.lang.String> alreadyChecked,
                                                                 java.lang.String methodToInvoke,
                                                                 java.util.Map<GuixGenerator,JavaFile> generatedFiles)
Checks if the objects of the binding exist and determines which objects need a listener

Parameters:
dbCreation - the method code to apply the binding
dbDeletion - the method code to remove the binding
prevTh - the TagHandler of the parent of the object inspected
jf - the javaFile of the inspected object (null if it is not a generated object)
clazz - the clazz of the inspected object (null if it is a generated object)
binding - the array containing the name of the objects to check
i - the index of the being checked object
alreadyChecked - list of the already checked objects
methodToInvoke - the name of the method which will process the databinding
generatedFiles - maps the GuixGenerator with its JavaFile
Returns:
the list of the listeners to add to the objects for the databinding


Copyright © 2009 CodeLutin. All Rights Reserved.