org.nuiton.guix.tags
Class ScriptHandler

java.lang.Object
  extended by org.nuiton.guix.tags.ScriptHandler

public class ScriptHandler
extends java.lang.Object

Handles the script tag and its contents.

Author:
morin

Nested Class Summary
static class ScriptHandler.ScriptPart
          The different parts of the script
 
Constructor Summary
ScriptHandler()
           
 
Method Summary
 java.lang.String compileScript(org.xmlpull.v1.XmlPullParser xpp, java.io.File scriptFile)
          Parse the script tag.
static java.util.Map<ScriptHandler.ScriptPart,java.lang.Object> decomposeScript(java.lang.String script)
          Decompose the script into the different parts
 java.lang.String loadScriptFile(java.io.File scriptFile)
          Loads the content of a script file
static java.lang.String postProcessInitializers(java.lang.String initializers, JavaField[] fields)
           
static java.lang.String postProcessMethodBody(JavaMethod method, JavaField[] fields)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ScriptHandler

public ScriptHandler()
Method Detail

loadScriptFile

public java.lang.String loadScriptFile(java.io.File scriptFile)
                                throws java.io.IOException
Loads the content of a script file

Parameters:
scriptFile - the file to load
Returns:
the content of the script file
Throws:
java.io.IOException - if an error occurs while reading scriptFile

compileScript

public java.lang.String compileScript(org.xmlpull.v1.XmlPullParser xpp,
                                      java.io.File scriptFile)
                               throws java.io.IOException,
                                      org.xmlpull.v1.XmlPullParserException
Parse the script tag.

Parameters:
xpp - the parser referencing the style tag
scriptFile - the file containing the code to compile
Returns:
the content of the file specified by the source attribute or the script between the script tags
Throws:
java.io.IOException
org.xmlpull.v1.XmlPullParserException

decomposeScript

public static java.util.Map<ScriptHandler.ScriptPart,java.lang.Object> decomposeScript(java.lang.String script)
Decompose the script into the different parts

Parameters:
script - the script to decompose
Returns:
a map containing the imports, the bodycode, the initializers and the methods of the script

postProcessMethodBody

public static java.lang.String postProcessMethodBody(JavaMethod method,
                                                     JavaField[] fields)

postProcessInitializers

public static java.lang.String postProcessInitializers(java.lang.String initializers,
                                                       JavaField[] fields)


Copyright © 2009 CodeLutin. All Rights Reserved.