我正在使用Mule SDK开发一个自定义连接器。我正在努力获取必要的元数据。下面是我使用的两个片段:WeatherConnectrOperations.java:
public class WeatherConnectrOperations {
public void select(@MetadataKeyId(RecordKeysResolver.class) String type) {
}
}RecordKeysResolver.java:
public class RecordKeysResolver implements TypeKeysResolver {
@Override
public String getCategoryName() {
return "Records";
}
@Override
public Set<MetadataKey> getKeys(MetadataContext context) throws MetadataResolvingException, ConnectionException {
System.out.println("Hello");
List<String> keyIds = Arrays.asList("Author_id", "BookList_id", "Book_id");
HashSet<MetadataKey> keys = new HashSet<>();
for (String id : keyIds) {
MetadataKeyBuilder builder = MetadataKeyBuilder.newKey(id);
builder.withDisplayName(StringUtils.removeEnd(id, "_id"));
keys.add(builder.build());
}
return keys;
}
}我的问题是,类型字段没有填充必要的键
我是按照这个文档做的- https://docs.mulesoft.com/mule-sdk/1.1/metadata-keys
发布于 2019-10-25 09:15:42
文档中没有提到这一点,但是元数据键似乎不会被解析,除非有匹配的输入/OutputTypeResolver。
确保匹配的Input/OutputTypeResolver具有与KeyResolver相同的KeyResolver,并且我还发现变量的名称在操作方法和输入/OutputTypeResolver中应该是相同的。
我猜逻辑是,如果没有元数据解析器,则不需要元数据键。如果您只需要一个下拉列表的值,您可以使用值提供者(https://docs.mulesoft.com/mule-sdk/1.1/value-providers)
https://stackoverflow.com/questions/56514383
复制相似问题