アクションから値を返す
CommandPkg で以下のプロパティを設定し、変数にアクションの出力を保存できます。
アクションの戻り値
- return_type
- アクションの戻り値を定義します。通常は、エントリ メソッドの戻り値の型と一致します。
- return_required
- true に設定した場合は、戻り値が必要です。
- return_label
- 変数に値を保存するよう求める場合の UI ラベル。
@BotCommand
@CommandPkg(label = "Uppercase", name = "uppercase", description="Converts the source string to upper case.",
icon = "uppercase.svg", node_label="Convert {{sourceString}} to upper case| and assign the result to {{returnTo}}|",
return_type=DataType.STRING, return_required = true, return_label="Assign the output to variable",
property_name="uppercase", property_description="Converts the string to upper case", property_type=DataType.STRING,
property_return_type=DataType.STRING) public class UpperCase {
@Execute
public Value<String> convert(
@Idx(index = "1", type=TEXT)
@Pkg(label="Source string")
@NotEmpty
String sourceString){
return new StringValue(sourceString.toUpperCase());
}
}
}