org.eclipse.xtext.purexbase.jvmmodel
Class PureXbaseJvmModelInferrer
java.lang.Object
org.eclipse.xtext.xbase.jvmmodel.AbstractModelInferrer
org.eclipse.xtext.purexbase.jvmmodel.PureXbaseJvmModelInferrer
- All Implemented Interfaces:
- IJvmModelInferrer
public class PureXbaseJvmModelInferrer
- extends AbstractModelInferrer
Infers a JVM model from the source model.
The JVM model should contain all elements that would appear in the Java code
which is generated from the source model.
Other Xtend models link against the JVM model rather than the source model. The JVM
model elements should be associated with their source element by means of the
IJvmModelAssociator
.
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
PureXbaseJvmModelInferrer
public PureXbaseJvmModelInferrer()
_infer
protected void _infer(Model m,
@NonNull
IJvmDeclaredTypeAcceptor acceptor,
boolean prelinkingPhase)
name
public java.lang.String name(org.eclipse.emf.ecore.resource.Resource res)
containsReturn
public boolean containsReturn(XExpression expr)
compile
public void compile(XBlockExpression obj,
ITreeAppendable appendable)
infer
public void infer(org.eclipse.emf.ecore.EObject m,
IJvmDeclaredTypeAcceptor acceptor,
boolean prelinkingPhase)
- Description copied from interface:
IJvmModelInferrer
This method is called at two different times in a resource's life-cycle, reflected by whether {preIndexingPhase}
is set to true
or false
. When set to true
everything is still in a
pre-indexing phase, that means linking hasn't been done yet. In this phase you just need to create the Jvm-elements
which should be indexed (i.e. found globally). For regular Xbase expressions only the JvmTypes with the correct
qualified name are needed at this point.
You must only infer Jvm elements which directly result from elements contained in the current resource!
When this method is called with preIndexingPhase set to false
, you need to do the full inference
including setting all links. But still you have to it in a particular order. First you need to create the
complete tree structure and make sure you have passed the created JvmTypes to the acceptor. Only pass top level
JvmType
s to the acceptor. Only if the tree structure is created and its
root types have been passed to the acceptor, you are free to resolve any cross references.
- Specified by:
infer
in interface IJvmModelInferrer
- Overrides:
infer
in class AbstractModelInferrer
- Parameters:
m
- the root element from the parse resultacceptor
- an acceptor awaiting derived root JvmDeclaredType
sprelinkingPhase
- whether the call is done in before indexing. During this phase clients may not rely on any global indexing information
and only need to to provide the information needed by the language's IDefaultResourceDescriptionStrategy
.
IF not implemented differently this is just the JvmDeclaredType
s with their qualified name, but no members and no other data.