aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main/java/com/google/devtools/build/lib/skylarkinterface/SkylarkCallable.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib/skylarkinterface/SkylarkCallable.java')
-rw-r--r--src/main/java/com/google/devtools/build/lib/skylarkinterface/SkylarkCallable.java19
1 files changed, 17 insertions, 2 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/skylarkinterface/SkylarkCallable.java b/src/main/java/com/google/devtools/build/lib/skylarkinterface/SkylarkCallable.java
index 86d2c88e3d..1b193fe1f1 100644
--- a/src/main/java/com/google/devtools/build/lib/skylarkinterface/SkylarkCallable.java
+++ b/src/main/java/com/google/devtools/build/lib/skylarkinterface/SkylarkCallable.java
@@ -45,12 +45,27 @@ public @interface SkylarkCallable {
/**
* If true, this method will be considered as a field of the enclosing Java object. E.g., if set
- * to true on a method {@code foo}, then the callsites of this method will look like
- * {@code bar.foo} instead of {@code bar.foo()}. The annotated method must be parameterless.
+ * to true on a method {@code foo}, then the callsites of this method will look like {@code
+ * bar.foo} instead of {@code bar.foo()}. The annotated method must be parameterless and {@link
+ * #parameters()} should be empty.
*/
boolean structField() default false;
/**
+ * Number of parameters in the signature that are mandatory positional parameters. Any parameter
+ * after {@link #mandatoryPositionals()} must be specified in {@link #parameters()}. A negative
+ * value (default is {@code -1}), means that all arguments are mandatory positionals if {@link
+ * #parameters()} remains empty. If {@link #parameters()} is non empty, then a negative value for
+ * {@link #mandatoryPositionals()} is taken as 0.
+ */
+ int mandatoryPositionals() default -1;
+
+ /**
+ * List of parameters this function accept after the {@link #mandatoryPositionals()} parameters.
+ */
+ Param[] parameters() default {};
+
+ /**
* Set it to true if the Java method may return <code>null</code> (which will then be converted to
* <code>None</code>). If not set and the Java method returns null, an error will be raised.
*/