gov.llnl.babel.backend
Class CodeGenerationFactory
java.lang.Object
gov.llnl.babel.backend.CodeGenerationFactory
public class CodeGenerationFactory
extends java.lang.Object
This class stores and serves up instances CodeGenerator based
on the string name of the code that the user wishes to generate.
Classes derived from CodeGenerator will register themselves
with this class (usually as part of a static initialization block).
If a match based on the string name is not available, this class
will try to dynamically load an instance based on some simple
naming rules.
CodeGenerationFactory() - Create a new instance of
CodeGenerationFactory and
initialize with reasonable defaults.
|
CodeGenerationFactory
public CodeGenerationFactory()
Create a new instance of CodeGenerationFactory
and
initialize with reasonable defaults.
getBuildGenerators
public Collection getBuildGenerators(String language)
Get the build generator appropriate for this language.
- A collection of BuildGenerator interfaces. The
elements of the collection are newly created instances.
Two calls to getBuildGenerators with the same arguments
will return separate instaces of the BuildGenerators.
getCodeGenerator
public CodeGenerator getCodeGenerator(String language,
String mode)
Get a registered codeGenerator from the factory.
language
- String name of the languagemode
- Usually one of "stub", "skel", "ior", or "text"
- Live CodeGenerator or null if no match found. When
not-null, the return value is a new instance of a CodeGenerator (i.e.,
two successive calls to getCodeGenerator with the same arguments
will return two distinct instances of this CodeGenerator).
printRegisteredGenerators
public void printRegisteredGenerators(PrintStream out)
registerBuildGenerator
public void registerBuildGenerator(BuildGenerator gen)
registerCodeGenerator
public void registerCodeGenerator(CodeGenerator gen)
Register a CodeGenerators with the factory.
gen
- instance of a CodeGenerator;