想象一下我有以下jBehave故事:
When I create servers with properties:
| processor | ram | os |
| i5 | 8 | win |
| i3 | 4 | lin |
Then ....
和
When I create install os with properties:
| type | version |
| win | vista |
| lin | centOS |
Then ....
以及这些故事的相应步骤定义:
@When("I create servers with properties:$servers")
public void createServers(Set<Server> servers) ...
和
@When("I install os with properties:$osSet")
public void createServers(Set<OS> osSet) ...
所以我需要一个转换器来将表输入转换为Set和Set。是否有可能 写这样的转换器?问题是集合仅在通用类型服务器和操作系统上有所不同。
最佳答案
执行 boolean accept(Type type)
应该没问题使用Type getGenericComponentType()
在 GenericArrayType
关于java - JBehave 转换器支持泛型吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6280960/