public abstract class BuckStarlarkFunction extends Object implements com.google.devtools.build.lib.syntax.StarlarkFunction
This class currently doesn't handle optionals and other java/skylark object coercing.
Constructor and Description |
---|
BuckStarlarkFunction(String methodName,
Constructor<?> constructor,
List<String> namedParams,
List<String> defaultSkylarkValues,
Set<String> noneableParams)
Creates a new skylark callable function of the given name that invokes the method handle.
|
BuckStarlarkFunction(String methodName,
Method method,
List<String> namedParams,
List<String> defaultSkylarkValues,
Set<String> noneableParams)
Creates a new skylark callable function of the given name that invokes the method handle.
|
Modifier and Type | Method and Description |
---|---|
Object |
call(List<Object> args,
Map<String,Object> kwargs,
com.google.devtools.build.lib.syntax.FuncallExpression nullableAst,
com.google.devtools.build.lib.syntax.Environment env) |
String |
getName() |
void |
repr(com.google.devtools.build.lib.skylarkinterface.SkylarkPrinter printer) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
public BuckStarlarkFunction(String methodName, Constructor<?> constructor, List<String> namedParams, List<String> defaultSkylarkValues, Set<String> noneableParams)
methodName
- the function name exposed to skylarkconstructor
- the constructor that we will call as a methodnamedParams
- a list of named parameters for skylark. The names are mapped in order to the
parameters of constructor
defaultSkylarkValues
- a list of default values for parameters in skylark. The names are
mapped in order to the parameters of constructor
public BuckStarlarkFunction(String methodName, Method method, List<String> namedParams, List<String> defaultSkylarkValues, Set<String> noneableParams)
methodName
- the function name exposed to skylarkmethod
- a method that will eventually be called in call(List, Map,
FuncallExpression, Environment)
namedParams
- a list of named parameters for skylark. The names are mapped in order to the
parameters of method
defaultSkylarkValues
- a list of default values for parameters in skylark. The values are
mapped in order to the parameters of method
public Object call(List<Object> args, @Nullable Map<String,Object> kwargs, @Nullable com.google.devtools.build.lib.syntax.FuncallExpression nullableAst, com.google.devtools.build.lib.syntax.Environment env) throws com.google.devtools.build.lib.syntax.EvalException, InterruptedException
call
in interface com.google.devtools.build.lib.syntax.StarlarkFunction
com.google.devtools.build.lib.syntax.EvalException
InterruptedException
public void repr(com.google.devtools.build.lib.skylarkinterface.SkylarkPrinter printer)
repr
in interface com.google.devtools.build.lib.skylarkinterface.SkylarkPrintable
public String getName()