@Retention(CLASS) @Target({PARAMETER})
public @interface IntentParam
Names and describes one parameter of an AppIntent handler.
Every parameter of a handler needs one, except an optional leading
com.codename1.intents.IntentContext. Supported types are String, int,
long, float, double, boolean, java.util.Date, and any class
annotated IntentEntity.
Methods
public abstract String value() | The parameter name used on the wire and in phrase placeholders. |
public abstract String title() default "" | What the platform asks when it needs this value – “Which playlist?”. |
public abstract boolean required() default true | Whether the intent can run without this value. |
public abstract String defaultValue() default "" | The value substituted when an optional parameter is absent. |
public abstract String[] options() default {} | A closed vocabulary of accepted values. |
Method details
value
public abstract String value()title
public abstract String title() default ""What the platform asks when it needs this value – “Which playlist?”.
Write it as a question to the user, because on iOS that is literally what Siri says out loud. Defaults to the parameter name, which is almost never what you want a user to hear.
required
public abstract boolean required() default truedefaultValue
public abstract String defaultValue() default ""The value substituted when an optional parameter is absent.
Only meaningful alongside required = false, and the build says so rather than letting
the two contradict each other: the platforms resolve that contradiction differently, one
treating the parameter as satisfied by the default and another still prompting for it.
It must also be a value the parameter’s type can actually hold, which the build checks too – a default it cannot parse would otherwise become 0, false or null at runtime.
options
public abstract String[] options() default {}A closed vocabulary of accepted values. String parameters only.
That restriction is enforced at build time because it is the only place it can be: the framework validates a vocabulary for strings and projects it to an iOS choice list, and nothing does either for other types – so options elsewhere would advertise a restriction that nothing applies.
The platform offers these as choices rather than asking for free text, and the framework rejects anything else before your handler runs. Use it instead of declaring an enum type: an enum would need its own resolution machinery on every platform for no gain over a checked string.