org.eclipse.xtend.backend.functions.internal
Class FunctionDefContextImpl

java.lang.Object
  extended by org.eclipse.xtend.backend.functions.internal.FunctionDefContextImpl
All Implemented Interfaces:
FunctionDefContext, FunctionDefContextInternal

public final class FunctionDefContextImpl
extends java.lang.Object
implements FunctionDefContextInternal

Author:
Arno Haase (http://www.haase-consulting.com), André Arnold

Constructor Summary
FunctionDefContextImpl()
           
 
Method Summary
 java.util.Collection<Function> findFunctionCandidates(QualifiedName functionName, java.util.List<BackendType> paramTypes, boolean firstParamIsThis)
          is public only for testing purposes
 java.util.Collection<NamedFunction> getAllFunctions()
           
 java.util.Collection<NamedFunction> getByFirstParameterType(BackendType firstParameterType)
          for reflection.
 Function getMatch(ExecutionContext ctx, QualifiedName name, java.util.List<BackendType> params)
          for reflection.
 java.util.Collection<NamedFunction> getPublicFunctions()
           
 boolean hasMatch(ExecutionContext ctx, QualifiedName functionName, java.util.List<? extends java.lang.Object> params)
          for dynamic matching, e.g.
 java.lang.Object invoke(ExecutionContext ctx, QualifiedName functionName, java.util.List<? extends java.lang.Object> params)
           
 java.lang.Object invoke(ExecutionContext ctx, QualifiedName functionName, java.util.List<? extends java.lang.Object> params, boolean firstParamIsThis)
           
 void register(NamedFunction f, boolean isPublic)
           
 java.lang.String toString()
           
 java.util.List<BackendType> typesForParameters(BackendTypesystem ts, java.util.List<?> params)
          is public only for testing purposes
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

FunctionDefContextImpl

public FunctionDefContextImpl()
Method Detail

register

public void register(NamedFunction f,
                     boolean isPublic)
Specified by:
register in interface FunctionDefContextInternal

invoke

public java.lang.Object invoke(ExecutionContext ctx,
                               QualifiedName functionName,
                               java.util.List<? extends java.lang.Object> params)
Specified by:
invoke in interface FunctionDefContext

invoke

public java.lang.Object invoke(ExecutionContext ctx,
                               QualifiedName functionName,
                               java.util.List<? extends java.lang.Object> params,
                               boolean firstParamIsThis)
Specified by:
invoke in interface FunctionDefContext

typesForParameters

public java.util.List<BackendType> typesForParameters(BackendTypesystem ts,
                                                      java.util.List<?> params)
is public only for testing purposes


findFunctionCandidates

public java.util.Collection<Function> findFunctionCandidates(QualifiedName functionName,
                                                             java.util.List<BackendType> paramTypes,
                                                             boolean firstParamIsThis)
is public only for testing purposes


getByFirstParameterType

public java.util.Collection<NamedFunction> getByFirstParameterType(BackendType firstParameterType)
Description copied from interface: FunctionDefContext
for reflection. This method returns all functions, both those separately registered and those "built into" the type.

Specified by:
getByFirstParameterType in interface FunctionDefContext

getMatch

public Function getMatch(ExecutionContext ctx,
                         QualifiedName name,
                         java.util.List<BackendType> params)
Description copied from interface: FunctionDefContext
for reflection. This method returns all functions, both those built-into the types and those registered separately.

Specified by:
getMatch in interface FunctionDefContext

hasMatch

public boolean hasMatch(ExecutionContext ctx,
                        QualifiedName functionName,
                        java.util.List<? extends java.lang.Object> params)
Description copied from interface: FunctionDefContext
for dynamic matching, e.g. to determine if a function should be called on a collection itself or on all of its members. This method matches against all functions, both those built into the types and those registered separately.

Specified by:
hasMatch in interface FunctionDefContext

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

getPublicFunctions

public java.util.Collection<NamedFunction> getPublicFunctions()
Specified by:
getPublicFunctions in interface FunctionDefContext

getAllFunctions

public java.util.Collection<NamedFunction> getAllFunctions()
Specified by:
getAllFunctions in interface FunctionDefContext