0
<properties>
<property name="p1">v1</property>
<property name="p2">v2</property>
</properties>
我想 {"p1"="v1", "p2"="v2"}
解析成Properties
對象這個默認值的屬性。我能夠使用普通消化器做到這一點。解析爲使用共享沼氣池
forPattern("properties").createObject()
.ofType(Properties.class);
forPattern("properties/property")
.callMethod("put").withParamCount(2)
.withParamTypes(Object.class, Object.class).then()
.callParam().fromAttribute("name").ofIndex(0).then()
.callParam().ofIndex(1);
另外我還想通過我有的默認對象。即,而不是new Properties()
,我需要做new Properties(defaults)
來創建屬性實例。我知道.usingConstructor(Properties.class).then()
,但沒有找到一種方法來通過現有的Properties
對象作爲參數。
我正在使用v3.3.2。 任何幫助是極大的讚賞