通过Flatworm创建列表

时间:2018-03-29 22:28:57

标签: java parsing

我正在尝试使用通过flatfile读取的字符串值来加载属性。

private List<String> attribute = new ArrayList<String>();

我创建了

public List<String> getAttribute() {
        return attribute;
    }

    public void setAttribute(List<String> attribute) {
        this.attribute = attribute;
    }

    public void addAttribute(String atr)
       {
        attribute.add(atr);
       }

让我们说我的输入记录是:

NHJames   Elliot   4183306636 4189965965 4182235656 

我想在该属性列表中加载最后3个电话号码。它可以是11个长度但可以是多个尺寸。

我在我的xml中试过:

<record-element length="11" addMethod="addAttribute" beanref="personInput.attribute" minCount="1" maxCount="99" type="char">
</record-element>

我收到argument type mismatch error

我关注http://flatworm.sourceforge.net/ 它甚至是可行的。任何帮助表示赞赏。

1 个答案:

答案 0 :(得分:0)

也许您的错误在于beanref="personInput.attribute"

<record-element length="11" addMethod="addAttribute" beanref="personInput.attribute" minCount="1" maxCount="99" type="char">
</record-element>

而是将beanref="personInput.attribute"替换为beanref="personInput"以成为:

<record-element length="11" addMethod="addAttribute" beanref="personInput" minCount="1" maxCount="99" type="char">
</record-element>