Java 转换在Dozer中具有一个参数的getter的j8583对象

Java 转换在Dozer中具有一个参数的getter的j8583对象,java,dozer,j8583,Java,Dozer,J8583,我有一个IsomeMessage对象(),它有一个内部数组,我只能通过getField(int)方法访问该数组 我检查了这篇文章,总线仍然卡在同一个地方,我想知道我是否可以通过使用API来实现这一点,这样我就可以动态地告诉我想从原始bean中获取哪些字段,我不熟悉推土机,但是字段1是位图getField(1)返回null我最终使用推土机直接访问内部对象的功能创建了rigth映射() com.solab.iso8583.IsoMessage j8583.example.transactionst

我有一个IsomeMessage对象(),它有一个内部数组,我只能通过getField(int)方法访问该数组


我检查了这篇文章,总线仍然卡在同一个地方,我想知道我是否可以通过使用API来实现这一点,这样我就可以动态地告诉我想从原始bean中获取哪些字段,我不熟悉推土机,但是字段1是位图
getField(1)
返回
null

我最终使用推土机直接访问内部对象的功能创建了rigth映射()


com.solab.iso8583.IsoMessage
j8583.example.transactionstance
字段[3]
参数

您的回答是对的,但在本例中,我们还没有进入isoMessage对象,我们正在尝试首先访问dozer上的方法或j8583字段,以将它们转换为内部业务POJO
public class IsoMessage {

    @SuppressWarnings("rawtypes")
    private IsoValue[] fields = new IsoValue[129];
    .........
    .........
    .........

    /** Returns the IsoValue for the specified field. First real field is 2. */
    @SuppressWarnings("unchecked")
    public <T> IsoValue<T> getField(int field) {
        return fields[field];
    }
public class TransactionInstance implements Serializable {

    private static final long serialVersionUID = 3429335891821913088L;
    private String transactionName;
    private Map<String, String> parameters;
<mapping map-id="a">
    <class-a>com.solab.iso8583.IsoMessage</class-a>
    <class-b>j8583.example.TransactionInstance</class-b>
    <field>
        <a get-method="getField" key="1">field</a>
        <b map-set-method="put">parameters</b>
    </field>
</mapping>
Exception in thread "main" org.dozer.MappingException: No read or write method found for field (field) in class (class com.solab.iso8583.IsoMessage)
    at org.dozer.propertydescriptor.GetterSetterPropertyDescriptor.determinePropertyType(GetterSetterPropertyDescriptor.java:319)
    at org.dozer.propertydescriptor.GetterSetterPropertyDescriptor.getPropertyType(GetterSetterPropertyDescriptor.java:76)
    at org.dozer.fieldmap.MapFieldMap.determineActualPropertyType(MapFieldMap.java:170)
    at org.dozer.fieldmap.MapFieldMap.getSrcFieldValue(MapFieldMap.java:95)
<mapping>
    <class-a is-accessible="true">com.solab.iso8583.IsoMessage</class-a>
    <class-b>j8583.example.TransactionInstance</class-b>
    <field>
        <a>fields[3]</a>
        <b set-method="addParameter" map-set-method="addParameter" key="field3">parameters
        </b>
    </field>

</mapping>