org.eclipse.xtend.expression
Class ExecutionContextImpl

java.lang.Object
  extended by org.eclipse.xtend.expression.ExecutionContextImpl
All Implemented Interfaces:
ExecutionContext, TypeSystem
Direct Known Subclasses:
XpandExecutionContextImpl

public class ExecutionContextImpl
extends java.lang.Object
implements ExecutionContext

Author:
Sven Efftinge (http://www.efftinge.de), Arno Haase, Peter Friese

Nested Class Summary
protected static class ExecutionContextImpl.ExtensionsForNameAndTypeCacheKey
           
 
Field Summary
protected  java.util.Map<Resource,java.util.Set<Extension>> allExtensionsPerResource
           
protected  VetoableCallback callback
           
protected  ExceptionHandler exceptionHandler
           
protected  Cache<Triplet<Resource,java.lang.String,java.util.List<Type>>,Extension> extensionsForNameAndTypesCache
           
protected  java.util.Map<Pair<java.lang.String,java.util.List<Type>>,Type> extensionsReturnTypeCache
           
protected  NullEvaluationHandler nullEvaluationHandler
           
protected  java.util.List<Around> registeredExtensionAdvices
           
protected  ResourceManager resourceManager
           
protected  TypeSystemImpl typeSystem
           
 
Fields inherited from interface org.eclipse.xtend.expression.ExecutionContext
IMPLICIT_VARIABLE
 
Constructor Summary
ExecutionContextImpl()
           
ExecutionContextImpl(java.util.Map<java.lang.String,Variable> globalVars)
           
ExecutionContextImpl(ResourceManager resourceManager, Resource resource, TypeSystemImpl typeSystem, java.util.Map<java.lang.String,Variable> variables, java.util.Map<java.lang.String,Variable> globalVars, org.eclipse.emf.mwe.core.monitor.ProgressMonitor monitor, ExceptionHandler exceptionHandler, java.util.List<Around> advices, NullEvaluationHandler neh2, java.util.Map<Resource,java.util.Set<Extension>> extensionPerResourceMap, VetoableCallback callback, Cache<Triplet<Resource,java.lang.String,java.util.List<Type>>,Extension> extensionsForNameAndTypesCache, java.util.Map<Pair<java.lang.String,java.util.List<Type>>,Type> extensionsReturnTypeCache)
           
ExecutionContextImpl(ResourceManager resourceManager, TypeSystemImpl typeSystem, java.util.Map<java.lang.String,Variable> globalVars)
           
ExecutionContextImpl(TypeSystemImpl ts)
           
ExecutionContextImpl(TypeSystemImpl ts, java.util.Map<java.lang.String,Variable> globalVars)
           
 
Method Summary
 ExecutionContextImpl cloneContext()
           
 ExecutionContext cloneWithoutMonitor()
           
 ExecutionContext cloneWithoutResource()
           
 ExecutionContext cloneWithoutVariables()
           
 ExecutionContext cloneWithResource(Resource ns)
           
 ExecutionContext cloneWithVariable(Variable v)
           
 Resource currentResource()
           
 Operation findOperation(java.lang.String name, java.lang.Object target, java.lang.Object[] params)
           
 Property findProperty(java.lang.String name, java.lang.Object target)
           
 Type[] findTypesForPrefix(java.lang.String prefix)
           
 java.util.Set<? extends Extension> getAllExtensions()
           
 Type[] getAllTypes()
           
 Type getBooleanType()
           
 VetoableCallback getCallback()
           
 Type getCollectionType(Type innerType)
           
 Extension getExtension(java.lang.String functionName, java.lang.Object[] actualParameters)
           
 java.util.List<Around> getExtensionAdvices()
           
 Extension getExtensionForTypes(java.lang.String functionName, Type[] parameterTypes)
           
 Type getFeatureType()
           
 java.util.Map<java.lang.String,Variable> getGlobalVariables()
          accessible only through special extension methods
protected  java.lang.String[] getImportedNamespaces()
           
 Type getIntegerType()
           
 Type getListType(Type innerType)
           
 java.util.List<MetaModel> getMetaModels()
           
 org.eclipse.emf.mwe.core.monitor.ProgressMonitor getMonitor()
          Retrieves the associated ProgressMonitor
 java.util.Set<java.lang.String> getNamespaces()
           
 Type getObjectType()
           
 Type getOperationType()
           
 Type getPropertyType()
           
 Type getRealType()
           
 ResourceManager getResourceManager()
          Retrieves the associated ResourceManager
 Type getReturnType(Extension extension, Type[] paramTypes, java.util.Set<AnalysationIssue> issues)
           
 Type getSetType(Type innerType)
           
 Type getStaticPropertyType()
           
 Type getStringType()
           
 Type getType(java.lang.Object obj)
           
 Type getTypeForName(java.lang.String name)
           
 Type getTypeType()
           
 Variable getVariable(java.lang.String name)
           
 java.util.Map<java.lang.String,Variable> getVisibleVariables()
           
 Type getVoidType()
           
 java.lang.Object handleNullEvaluation(SyntaxElement element)
           
 void handleRuntimeException(java.lang.RuntimeException ex, SyntaxElement element, java.util.Map<java.lang.String,java.lang.Object> additionalContextInfo)
           
 void postTask(java.lang.Object element)
           
 void preTask(java.lang.Object element)
           
 void registerExtensionAdvices(java.lang.String fullyQualifiedName)
           
 void registerMetaModel(MetaModel mm)
           
 void release()
          Clears internal resources (caches).
 void setCallBack(Callback callback)
          Deprecated. Use setVetoableCallBack(VetoableCallback)
 void setFileEncoding(java.lang.String encoding)
          Deprecated. Use getResourceManager().setFileEncoding() instead
 void setMonitor(org.eclipse.emf.mwe.core.monitor.ProgressMonitor monitor)
           
 void setVetoableCallBack(VetoableCallback callback)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

resourceManager

protected ResourceManager resourceManager

typeSystem

protected final TypeSystemImpl typeSystem

exceptionHandler

protected ExceptionHandler exceptionHandler

nullEvaluationHandler

protected NullEvaluationHandler nullEvaluationHandler

callback

protected VetoableCallback callback

allExtensionsPerResource

protected java.util.Map<Resource,java.util.Set<Extension>> allExtensionsPerResource

extensionsForNameAndTypesCache

protected Cache<Triplet<Resource,java.lang.String,java.util.List<Type>>,Extension> extensionsForNameAndTypesCache

registeredExtensionAdvices

protected java.util.List<Around> registeredExtensionAdvices

extensionsReturnTypeCache

protected java.util.Map<Pair<java.lang.String,java.util.List<Type>>,Type> extensionsReturnTypeCache
Constructor Detail

ExecutionContextImpl

public ExecutionContextImpl()

ExecutionContextImpl

public ExecutionContextImpl(TypeSystemImpl ts)

ExecutionContextImpl

public ExecutionContextImpl(java.util.Map<java.lang.String,Variable> globalVars)

ExecutionContextImpl

public ExecutionContextImpl(TypeSystemImpl ts,
                            java.util.Map<java.lang.String,Variable> globalVars)

ExecutionContextImpl

public ExecutionContextImpl(ResourceManager resourceManager,
                            TypeSystemImpl typeSystem,
                            java.util.Map<java.lang.String,Variable> globalVars)

ExecutionContextImpl

public ExecutionContextImpl(ResourceManager resourceManager,
                            Resource resource,
                            TypeSystemImpl typeSystem,
                            java.util.Map<java.lang.String,Variable> variables,
                            java.util.Map<java.lang.String,Variable> globalVars,
                            org.eclipse.emf.mwe.core.monitor.ProgressMonitor monitor,
                            ExceptionHandler exceptionHandler,
                            java.util.List<Around> advices,
                            NullEvaluationHandler neh2,
                            java.util.Map<Resource,java.util.Set<Extension>> extensionPerResourceMap,
                            VetoableCallback callback,
                            Cache<Triplet<Resource,java.lang.String,java.util.List<Type>>,Extension> extensionsForNameAndTypesCache,
                            java.util.Map<Pair<java.lang.String,java.util.List<Type>>,Type> extensionsReturnTypeCache)
Method Detail

getCallback

public VetoableCallback getCallback()
Specified by:
getCallback in interface ExecutionContext

registerMetaModel

public void registerMetaModel(MetaModel mm)

getMetaModels

public java.util.List<MetaModel> getMetaModels()

findOperation

public Operation findOperation(java.lang.String name,
                               java.lang.Object target,
                               java.lang.Object[] params)
Specified by:
findOperation in interface TypeSystem

findProperty

public Property findProperty(java.lang.String name,
                             java.lang.Object target)
Specified by:
findProperty in interface TypeSystem

findTypesForPrefix

public Type[] findTypesForPrefix(java.lang.String prefix)
Specified by:
findTypesForPrefix in interface TypeSystem

getAllTypes

public Type[] getAllTypes()
Specified by:
getAllTypes in interface TypeSystem

getNamespaces

public java.util.Set<java.lang.String> getNamespaces()
Specified by:
getNamespaces in interface TypeSystem

getBooleanType

public Type getBooleanType()
Specified by:
getBooleanType in interface TypeSystem

getCollectionType

public Type getCollectionType(Type innerType)
Specified by:
getCollectionType in interface TypeSystem

getFeatureType

public Type getFeatureType()
Specified by:
getFeatureType in interface TypeSystem

getIntegerType

public Type getIntegerType()
Specified by:
getIntegerType in interface TypeSystem

getListType

public Type getListType(Type innerType)
Specified by:
getListType in interface TypeSystem

getObjectType

public Type getObjectType()
Specified by:
getObjectType in interface TypeSystem

getOperationType

public Type getOperationType()
Specified by:
getOperationType in interface TypeSystem

getPropertyType

public Type getPropertyType()
Specified by:
getPropertyType in interface TypeSystem

getRealType

public Type getRealType()
Specified by:
getRealType in interface TypeSystem

getSetType

public Type getSetType(Type innerType)
Specified by:
getSetType in interface TypeSystem

getStaticPropertyType

public Type getStaticPropertyType()
Specified by:
getStaticPropertyType in interface TypeSystem

getStringType

public Type getStringType()
Specified by:
getStringType in interface TypeSystem

getType

public Type getType(java.lang.Object obj)
Specified by:
getType in interface TypeSystem

getTypeForName

public Type getTypeForName(java.lang.String name)
Specified by:
getTypeForName in interface TypeSystem

getImportedNamespaces

protected java.lang.String[] getImportedNamespaces()

getTypeType

public Type getTypeType()
Specified by:
getTypeType in interface TypeSystem

getVoidType

public Type getVoidType()
Specified by:
getVoidType in interface TypeSystem

cloneContext

public ExecutionContextImpl cloneContext()

setFileEncoding

@Deprecated
public void setFileEncoding(java.lang.String encoding)
Deprecated. Use getResourceManager().setFileEncoding() instead


getVariable

public Variable getVariable(java.lang.String name)
Specified by:
getVariable in interface ExecutionContext

getVisibleVariables

public java.util.Map<java.lang.String,Variable> getVisibleVariables()
Specified by:
getVisibleVariables in interface ExecutionContext

getGlobalVariables

public java.util.Map<java.lang.String,Variable> getGlobalVariables()
Description copied from interface: ExecutionContext
accessible only through special extension methods

Specified by:
getGlobalVariables in interface ExecutionContext

cloneWithVariable

public ExecutionContext cloneWithVariable(Variable v)
Specified by:
cloneWithVariable in interface ExecutionContext

cloneWithoutVariables

public ExecutionContext cloneWithoutVariables()
Specified by:
cloneWithoutVariables in interface ExecutionContext

cloneWithResource

public ExecutionContext cloneWithResource(Resource ns)
Specified by:
cloneWithResource in interface ExecutionContext

cloneWithoutResource

public ExecutionContext cloneWithoutResource()
Specified by:
cloneWithoutResource in interface ExecutionContext

cloneWithoutMonitor

public ExecutionContext cloneWithoutMonitor()
Specified by:
cloneWithoutMonitor in interface ExecutionContext

currentResource

public Resource currentResource()
Specified by:
currentResource in interface ExecutionContext

getAllExtensions

public java.util.Set<? extends Extension> getAllExtensions()
Specified by:
getAllExtensions in interface ExecutionContext

getExtensionForTypes

public Extension getExtensionForTypes(java.lang.String functionName,
                                      Type[] parameterTypes)
Specified by:
getExtensionForTypes in interface ExecutionContext

getExtension

public Extension getExtension(java.lang.String functionName,
                              java.lang.Object[] actualParameters)
Specified by:
getExtension in interface ExecutionContext

setMonitor

public void setMonitor(org.eclipse.emf.mwe.core.monitor.ProgressMonitor monitor)

getMonitor

public org.eclipse.emf.mwe.core.monitor.ProgressMonitor getMonitor()
Description copied from interface: ExecutionContext
Retrieves the associated ProgressMonitor

Specified by:
getMonitor in interface ExecutionContext

preTask

public void preTask(java.lang.Object element)
Specified by:
preTask in interface ExecutionContext

postTask

public void postTask(java.lang.Object element)
Specified by:
postTask in interface ExecutionContext

handleRuntimeException

public void handleRuntimeException(java.lang.RuntimeException ex,
                                   SyntaxElement element,
                                   java.util.Map<java.lang.String,java.lang.Object> additionalContextInfo)
Specified by:
handleRuntimeException in interface ExecutionContext

getResourceManager

public ResourceManager getResourceManager()
Description copied from interface: ExecutionContext
Retrieves the associated ResourceManager

Specified by:
getResourceManager in interface ExecutionContext

registerExtensionAdvices

public void registerExtensionAdvices(java.lang.String fullyQualifiedName)

getExtensionAdvices

public java.util.List<Around> getExtensionAdvices()
Specified by:
getExtensionAdvices in interface ExecutionContext

handleNullEvaluation

public java.lang.Object handleNullEvaluation(SyntaxElement element)
Specified by:
handleNullEvaluation in interface ExecutionContext

release

public void release()
Description copied from interface: TypeSystem
Clears internal resources (caches).

Specified by:
release in interface TypeSystem

setCallBack

@Deprecated
public void setCallBack(Callback callback)
Deprecated. Use setVetoableCallBack(VetoableCallback)


setVetoableCallBack

public void setVetoableCallBack(VetoableCallback callback)

getReturnType

public Type getReturnType(Extension extension,
                          Type[] paramTypes,
                          java.util.Set<AnalysationIssue> issues)
Specified by:
getReturnType in interface ExecutionContext