將操作公開爲屬性
如果操作不接受任何參數,則可以將其作爲屬性公開。 可以通過在 CommandPkg 上設置以下屬性來完成此操作。
Action 屬性值
- 屬性名稱
- 屬性的名稱在動作層級是唯一的 , 在自動完成方塊中會出現此名稱。
- property_description
- 屬性的描述。
- 屬性類型
- 只有當類型匹配時,屬性纔會顯示在自動完成框中的數據類型。
- property_return_type
- 屬性返回的數據類型。如果此類型與使用該類型的字段類型不匹配,則會出現驗證錯誤。
@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());
}
}