Package org.eclipse.xtext.generator
Interface IGenerator2
-
- All Known Implementing Classes:
AbstractGenerator,GeneratorDelegate
public interface IGenerator2Replacement interface for theIGeneratorthat adds support for parallel code generation. Clients ofIGeneratorthat want to perform the code generation in the background will check for this extension interface and usebeforeGenerate(Resource, IFileSystemAccess2, IGeneratorContext)to prepare the resource set. That is, implementors may alter the state of the resource set in the before hook. This may happen implicitly by resolving proxies or explicitly by loading new resources into the resource set. No changes are allowed whiledoGenerate(Resource, IFileSystemAccess2, IGeneratorContext)is executed since this may be parallelized by the caller. TheafterGenerate(Resource, IFileSystemAccess2, IGeneratorContext)is used to cleanup state. Also access to the file system is guaranteed to be synchronous in the before and after hook.- Since:
- 2.9
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidafterGenerate(org.eclipse.emf.ecore.resource.Resource input, IFileSystemAccess2 fsa, IGeneratorContext context)Release any data that is no longer necessary after the generator ran.voidbeforeGenerate(org.eclipse.emf.ecore.resource.Resource input, IFileSystemAccess2 fsa, IGeneratorContext context)Before the generation is triggered, the resource or the entire resource set may be prepared such that no modification will happen whiledoGenerate(Resource, IFileSystemAccess2, IGeneratorContext)is executed.voiddoGenerate(org.eclipse.emf.ecore.resource.Resource input, IFileSystemAccess2 fsa, IGeneratorContext context)Perform the code generation for the given input resource.
-
-
-
Method Detail
-
doGenerate
void doGenerate(org.eclipse.emf.ecore.resource.Resource input, IFileSystemAccess2 fsa, IGeneratorContext context)Perform the code generation for the given input resource. Any number of files may be created or modified. Write operations to the given file system access may be processed asynchronous and are non-blocking if the given fsa is implementing that pattern. Read operations will happen in the background but are blocking.
-
beforeGenerate
void beforeGenerate(org.eclipse.emf.ecore.resource.Resource input, IFileSystemAccess2 fsa, IGeneratorContext context)Before the generation is triggered, the resource or the entire resource set may be prepared such that no modification will happen whiledoGenerate(Resource, IFileSystemAccess2, IGeneratorContext)is executed.
-
afterGenerate
void afterGenerate(org.eclipse.emf.ecore.resource.Resource input, IFileSystemAccess2 fsa, IGeneratorContext context)Release any data that is no longer necessary after the generator ran. This is guaranteed to be called ifbeforeGenerate(Resource, IFileSystemAccess2, IGeneratorContext)was called. It may be called several times. It may be called even ifbeforeGenerate(Resource, IFileSystemAccess2, IGeneratorContext)was not called.
-
-