org.stjs.generator
Class GenerationContext<JS>
java.lang.Object
org.stjs.generator.GenerationContext<JS>
- All Implemented Interfaces:
- TreePathHolder
public class GenerationContext<JS>
- extends Object
- implements TreePathHolder
This class can resolve an identifier or a method in the given source context. There is one context create for each
generation process.
- Author:
- Alexandru Craciun
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
GenerationContext
public GenerationContext(File inputFile,
GeneratorConfiguration configuration,
JavaScriptNameProvider names,
com.sun.source.util.Trees trees,
ClassLoader builtProjectClassLoader,
Map<GenerationContext.AnnotationCacheKey,Object> cacheAnnotations,
JavaScriptBuilder<JS> javaScriptBuilder)
getInputFile
public File getInputFile()
getConfiguration
public GeneratorConfiguration getConfiguration()
getNames
public JavaScriptNameProvider getNames()
getTrees
public com.sun.source.util.Trees getTrees()
setTrees
public void setTrees(com.sun.source.util.Trees trees)
getCurrentPath
public com.sun.source.util.TreePath getCurrentPath()
- Specified by:
getCurrentPath in interface TreePathHolder
setCurrentPath
public void setCurrentPath(com.sun.source.util.TreePath currentPath)
- Specified by:
setCurrentPath in interface TreePathHolder
getElements
public Elements getElements()
setElements
public void setElements(Elements elements)
getTypes
public Types getTypes()
setTypes
public void setTypes(Types types)
getChecks
public Checks getChecks()
getCompilationUnit
public com.sun.source.tree.CompilationUnitTree getCompilationUnit()
setCompilationUnit
public void setCompilationUnit(com.sun.source.tree.CompilationUnitTree compilationUnit)
addError
public JavascriptFileGenerationException addError(com.sun.source.tree.Tree tree,
String message)
withPosition
public JS withPosition(com.sun.source.tree.Tree tree,
JS node)
- add the position of the Java original node in the generated node.
- Parameters:
tree - node -
- Returns:
getStartLine
public int getStartLine(com.sun.source.tree.Tree tree)
- Parameters:
tree -
- Returns:
- the starting line of the given tree node
js
public JavaScriptBuilder<JS> js()
writeJavaScript
public void writeJavaScript(JS astRoot,
Writer writer)
writeSourceMap
public void writeSourceMap(Writer sourceMapWriter)
throws IOException
- Throws:
IOException
getCurrentWrapper
public <T extends com.sun.source.tree.Tree> TreeWrapper<T,JS> getCurrentWrapper()
wrap
public <T extends com.sun.source.tree.Tree> TreeWrapper<T,JS> wrap(com.sun.source.util.TreePath path)
wrap
public <T extends com.sun.source.tree.Tree> TreeWrapper<T,JS> wrap(Element enclosingElement)
getBuiltProjectClassLoader
public ClassLoader getBuiltProjectClassLoader()
getAnnotation
public <T extends Annotation> T getAnnotation(Element element,
Class<T> annotationType)
Copyright © 2014. All Rights Reserved.