org.eclipse.xtend.middleend.javaannotations.internal
Class JavaDefinedFunction

java.lang.Object
  extended by org.eclipse.xtend.backend.functions.AbstractFunction
      extended by org.eclipse.xtend.middleend.javaannotations.internal.JavaDefinedFunction
All Implemented Interfaces:
Function

public final class JavaDefinedFunction
extends AbstractFunction

This class represents a "helper" function that is defined in a Java class but for which the defining object is not an explicit parameter. It is used for "JAVA extension" style functions.
If it represents a non-static method, a single instance of the underlying class is shared by all methods of the class, and across all compilation units etc. from which they are referenced. This single instance is scoped with the ExecutionContext used.

Author:
Arno Haase (http://www.haase-consulting.com)

Field Summary
 
Fields inherited from class org.eclipse.xtend.backend.functions.AbstractFunction
_returnType
 
Constructor Summary
JavaDefinedFunction(java.lang.reflect.Method mtd, ExpressionBase guard, BackendTypesystem ts)
          shortcut constructor that attempts to derive the parameter types from the method's signature
JavaDefinedFunction(java.lang.reflect.Method mtd, java.util.List<BackendType> parameterTypes, BackendType returnType, ExpressionBase guard)
          This constructor provides full control
 
Method Summary
 java.lang.reflect.Method getMethod()
           
 java.lang.String getName()
           
static java.util.List<BackendType> guessParameterTypes(java.lang.reflect.Method mtd, BackendTypesystem ts)
           
 java.lang.Object invoke(ExecutionContext ctx, java.lang.Object[] params)
          this method is permitted to modify the param array that is passed in
 java.lang.String toString()
           
 
Methods inherited from class org.eclipse.xtend.backend.functions.AbstractFunction
getFunctionDefContext, getGuard, getParameterTypes, getReturnType, isCached, setFunctionDefContext
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

JavaDefinedFunction

public JavaDefinedFunction(java.lang.reflect.Method mtd,
                           ExpressionBase guard,
                           BackendTypesystem ts)
shortcut constructor that attempts to derive the parameter types from the method's signature


JavaDefinedFunction

public JavaDefinedFunction(java.lang.reflect.Method mtd,
                           java.util.List<BackendType> parameterTypes,
                           BackendType returnType,
                           ExpressionBase guard)
This constructor provides full control

Method Detail

guessParameterTypes

public static java.util.List<BackendType> guessParameterTypes(java.lang.reflect.Method mtd,
                                                              BackendTypesystem ts)

getName

public java.lang.String getName()

getMethod

public java.lang.reflect.Method getMethod()

invoke

public java.lang.Object invoke(ExecutionContext ctx,
                               java.lang.Object[] params)
Description copied from interface: Function
this method is permitted to modify the param array that is passed in


toString

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